O(n^2) is a quadratic function–as the value increased, the number of comparisons is squared which increases the amount of work as the characters increase.
O(n) may be easier to calculate the number of characters by sorting; however, it could include the letters that multiply which is not what we want.
O(n log n) is the quickest since the values are small and could, most likely, sort out any repeating letters in an isogram.
I like your answer to this highly debatable and subjective topic
1 Like