Count Vowels in a String

In this lesson, we will learn how to find the number of vowels in a string using recursion.

Problem Statement

Imagine that we have to find the number of vowels in a given string. We know that the English alphabet contains 55 vowels: a,e,i,o,ua, e, i, o, u. Let’s solve this problem using both iterative and recursive methods.

Iterative Method

To solve this problem we have to traverse the entire string so that we can initiate a simple for loop.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy