Skip to content

ORIGINAL CODING QUESTION

Vowel tally in a profile keyword

A profile keyword is encoded as glyphs 1 to 26 for the letters a to z. Count how many glyphs are vowels, meaning a, e, i, o or u (glyphs 1, 5, 9, 15 and 21). Repeated vowels each count.

Open practice workspace

Original exercise · easy. Editorial role relevance does not imply a company has asked this question.

Input and output

First integer n, then n glyphs. Print the vowel count.

Constraints

1 ≤ n ≤ 200; each glyph is in [1, 26].

Example 1

Input

5
3 15 4 5 18

Output

2

The word is coder; o and e are vowels.

Example 2

Input

3
19 11 25

Output

0

The word is sky, which has no vowels from the list.

Explain your approach

Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?

Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.

Hint 1

Only five glyph values matter.

Hint 2

Put the vowel glyphs in a set or compare against each of them.

Hint 3

Loop once over the glyphs and add one whenever the glyph is 1, 5, 9, 15 or 21.

Practice this question

Save your work privately, explain decisions and return to your revision queue.

Open practice workspaceBrowse the question library →