deno.land / x / masx200_leetcode_test@10.6.5 / remove-all-adjacent-duplicates-in-string / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export default function removeDuplicates(s: string): string { const stack: string[] = []; for (const ch of s) { if (stack.length) { const last = stack[stack.length - 1]; if (last === ch) { stack.pop(); continue; } } stack.push(ch); } return stack.join("");}
masx200_leetcode_test

Version Info

Tagged at
a year ago