BackmediumArrays Infosys

Vowel Frequency Analysis Solution

Problem Statement

Given an array of strings `vowelStrings`, write a function to determine the total count of vowels in each string and return the array of vowel counts.

Example 1
Input
['hello', 'world', 'python']
Output
[2, 1, 1]

Explanation: Step-by-step: 1. Iterate over each string in the input array. 2. For each string, iterate over each character. 3. Check if the character is a vowel (a, e, i, o, u). 4. If the character is a vowel, increment the vowel count for that string. 5. After iterating over all characters in the string, add the vowel count to the output array.

Example 2
Input
['aeiou', 'bcdfg', 'hjklm']
Output
[5, 0, 0]

Explanation: Step-by-step: 1. Iterate over each string in the input array. 2. For each string, iterate over each character. 3. Check if the character is a vowel (a, e, i, o, u). 4. If the character is a vowel, increment the vowel count for that string. 5. After iterating over all characters in the string, add the vowel count to the output array.

Constraints

  • 1 <= length of string <= 10^5
  • string contains only lowercase English letters
  • string can be empty
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free