3 ms·
> And it hit me that it's actually O(n), because we've got an array and have to iterate over every element to see if the element matches char. No, it's actuall
by F-0X 6y ago
> And it hit me that it's actually O(n), because we've got an array and have to iterate over every element to see if the element matches char.
No, it's actually O(1). n refers to the _input_, which is always a single character. The iteration over an array (fixed at 5 elements) means a maximum of 5 comparisons. O(isVowel) = 5.