Given a String, reverse it and remove repeated characters.
Anonimo
Create a hashset. Iterate through the string. If the character is already present in the set, continue else add the character to the answer string. Each time, add the character to the set. Then, reverse the answer string normally. Time complexity : O(n). Space complexity : O(m) where m is the number of distinct characters in the string.