Algorithm to get count of distinct vowels in a word
What could be the best algorithm to check if an English word contains at least 2 vowels in it.
P.S - Irrespective of any programming language.
Solution
Write a function to check if something is a vowel.
Create a map from vowels to counts, initialized to zeroes.
Iterate through the word one character at a time. If a character is a vowel (using function in 1), then increment the counter associated with that vowel.
Iterate through the map and if there are at least two nonzero values, return true.