Frage im Vorstellungsgespräch bei Microsoft

Here is a string with duplicate characters in java. Remove the duplicate characters. Return value is a string

Antwort im Vorstellungsgespräch

Anonym

10. März 2011

You can use a hashtable for this -- if you find any collisions, (i.e., if hashtable.contains(character at position i in a for loop), then don't add that character to your new string. There are plenty of less-efficient ways to do this, but the hashtable answer is what I used for making it more efficient.

1