Algorithm: find unique characters in a string using javascript
Problem :
Given a string find all the unique characters in the stirng.
Input : A string
Output : A string
Logic :
- Iterate over entire string and create a frequency map
- If the character occurs for the first time then set its value to 1
- Else set its value to -1.
- return a string with characters whose frequency was 1 in the frequency map.
Time complexity : O(n) ; where n is the string length
Space complexity : O(1) ; constant
Solution :