Sunday, September 2, 2012

Unique Characters in a String

Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?

SAMPLE Input/Output:

String: abcb
Has Unique chars: false
String: want
Has Unique chars: true
String: calls
Has Unique chars: false
String: x
Has Unique chars: true
String: 
Has Unique chars: true
String: aa
Has Unique chars: false
String: mn
Has Unique chars: true

No comments:

Post a Comment