Determine if a string has all Unique Characters

Question :

Determine giving string has all Unique Characters. Without Using additional data structures.

Solution :

  1. Convert String to Char Array 
  2. Sort Char Array
  3. Compare char[i ] == char[i+1] if true then String not has all uniques characters.

Output :

Unique character String : false

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.