724. Count Vowels in a String Recursively

EasyRecursionRecursion

Given a string s, return the number of vowel characters it contains, where vowels are the letters a, e, i, o, u in either lowercase or uppercase. You must count the vowels recursively, not with a loop.

Input: A string s enclosed in double quotes.

Output: Return an integer count of vowels.

Examples

Example 1
Input: "hello"
Output: 2
Explanation: 'e' and 'o' are vowels.
Example 2
Input: "AEIOU"
Output: 5
Explanation: All five uppercase vowels.
Example 3
Input: "bcdfg"
Output: 0
Explanation: No vowels.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →