My vote for Big O -> O(n)

As we only have 26 letters in the alphabet, it is reasonable to allocate 26 ‘empty boxes’ in the code, one for each letter of the alphabet.

Then we go through each letter of the word and put it in the respective box we have allocated for that specific alphabet letter.
If we ever try to put a letter in an already occupied box, we do NOT have an Isogram.

This thinking and solution is only possible due to the limited number of characters a letter can take, and thus quite specific for this kind of problem.

Privacy & Terms