Skip to content

Instantly share code, notes, and snippets.

@ahmet-cetinkaya
Created November 24, 2020 14:40
Show Gist options
  • Save ahmet-cetinkaya/de9f196deeb6ed23847f6cf4567b09bc to your computer and use it in GitHub Desktop.
Save ahmet-cetinkaya/de9f196deeb6ed23847f6cf4567b09bc to your computer and use it in GitHub Desktop.
LeetCode Solution 1047. Remove All Adjacent Duplicates In String
const removeDuplicates = (S) => S.match(/(.)\1/g) ? removeDuplicates(S.replace(/(.)\1/g, '')) : S;
@ahmet-cetinkaya
Copy link
Author

ahmet-cetinkaya commented Nov 24, 2020

Result:
Runtime: 84 ms, faster than 95.12% of JavaScript online submissions for Remove All Adjacent Duplicates In String.
Memory Usage: 41.9 MB, less than 96.97% of JavaScript online submissions for Remove All Adjacent Duplicates In String.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment