Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Sort an array of words based on the number of vowels. If two words have the same count, sort alphabetically.

Hard

Problem Statement

Sort an array of words based on the number of vowels. If two words have the same count, sort alphabetically.

Sample Input

['apple', 'banana', 'cherry', 'date']

Sample Output

["cherry", "apple", "date", "banana"]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
def vowel_sort(words) # Your code here end
Log in or sign up to run or submit your code.Log inSign up
Input
['apple', 'banana', 'cherry', 'date']
Expected Output
["cherry", "apple", "date", "banana"]