Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randhir200/reduce-string
Given a string of lowercase characters in range ascii[‘a’..’z’]. You can perform one operation on this string in which you can selects a pair of adjacent lowercase letters that match, and delete them. For instance, the string aab could be shortened to b in one operation. Your task is to delete as many characters as possible using this method and print the resulting string. If the final string is empty, print "Empty String" (without quotes). Please note that characters can be deleted only if they form a pair and are same(i.e from aaa we can only delete 2 a's and will be left with a single a). I know there exists a simple implemented Stringentation based solution of this question, but please try to come up with an approach that uses stack data structure to solve the purpose
https://github.com/randhir200/reduce-string
Last synced: 1 day ago
JSON representation
Given a string of lowercase characters in range ascii[‘a’..’z’]. You can perform one operation on this string in which you can selects a pair of adjacent lowercase letters that match, and delete them. For instance, the string aab could be shortened to b in one operation. Your task is to delete as many characters as possible using this method and print the resulting string. If the final string is empty, print "Empty String" (without quotes). Please note that characters can be deleted only if they form a pair and are same(i.e from aaa we can only delete 2 a's and will be left with a single a). I know there exists a simple implemented Stringentation based solution of this question, but please try to come up with an approach that uses stack data structure to solve the purpose
- Host: GitHub
- URL: https://github.com/randhir200/reduce-string
- Owner: Randhir200
- Created: 2022-05-22T03:58:08.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T04:01:08.000Z (over 2 years ago)
- Last Synced: 2023-03-10T04:11:46.790Z (almost 2 years ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0