We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64b9363 commit 0bb4223Copy full SHA for 0bb4223
problems/1047.删除字符串中的所有相邻重复项.md
@@ -186,6 +186,24 @@ class Solution:
186
187
Go:
188
189
+javaScript:
190
+
191
+```js
192
+/**
193
+ * @param {string} s
194
+ * @return {string}
195
+ */
196
+var removeDuplicates = function(s) {
197
+ const stack = [];
198
+ for(const x of s) {
199
+ let c = null;
200
+ if(stack.length && x === (c = stack.pop())) continue;
201
+ c && stack.push(c);
202
+ stack.push(x);
203
+ }
204
+ return stack.join("");
205
+};
206
+```
207
208
209
0 commit comments