UNACADEMY Hiring Off-Campus OA (2021) Problem Maximum Number of Vowels in a Substring of Given Length

Question · Posted Jun 2026

Problem Statement You are given a string s consisting of lowercase English letters and an integer k. Your task is to find the maximum number of vowels present in any substring of length exactly k. The vowels are: a e i o u Return the maximum count of vowels that can appear in any substring of size k. Example 1 Input s = "abciiidef" k = 3 Output 3 Explanation Substrings of length 3: "abc" → 1 vowel "bci" → ...

The full answer & interview discussion are available to premium members.

Log in Create a free account