Remove repeated characters from a string

You are given a string. Develop a function to remove duplicate characters from that string. String could be of any length. Your algorithm must be in space. If you wish you can use constant size extra space which is independent of string size. Your algorithm must be of complexity of O(n). Example: Given string is BANANAS. Output must be BANS. All repeated characters are removed.

Comments

Popular posts from this blog