Sunday, September 2, 2012

Remove Duplicate Characters from String


Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer.

Sample Input/Output:

String: programming
after removing duplicate chars: progamin
String: words
after removing duplicate chars: words
String: texts
after removing duplicate chars: texs
String: a
after removing duplicate chars: a
String: aa
after removing duplicate chars: a
String: ba
after removing duplicate chars: ba

No comments:

Post a Comment