Grokking 75: Top Coding Interview Questions
Ask Author
Back to course home

0% completed

Maximum Number of Vowels in a Substring of Given Length (medium)
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Given a string s and an integer k, return the highest number of vowels in any substring of s that is exactly k characters long. Vowels in English are 'a', 'e', 'i', 'o', and 'u'.

Examples

Example 1:

  • Input: s = "azerdii", k = 4
  • Expected Output: 2
  • Justification: The substring "rdii" has two vowels ('i', 'i').

Example 2:

  • Input: s = "abcde", k = 2
  • Expected Output: 1
  • Justification: The substring "ab" contains one vowel ('a').

Example 3:

  • Input: s = "zaeixoyuxyz", k = 7

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible