Skip to content

Instantly share code, notes, and snippets.

@jingxiang714
jingxiang714 / 1_1isUnique
Created August 1, 2017 04:59
CrackingTheCodingInterview_6th_Solution
/*
Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
*/
/*
One solution is to create an array of boolean values, where the flag at index i indicates
whether character i in the alphabet is contained in the string.
We can also immediately return false if the string length exceeds the number of unique
characters in the alphabet.