BackeasyStrings Swiggy

Balanced Vowel Casing Solution

Problem Statement

Given a string s, determine if the number of uppercase vowels ('A', 'E', 'I', 'O', 'U') is exactly equal to the number of lowercase vowels ('a', 'e', 'i', 'o', 'u') present in the string. Non-vowel characters should be ignored.

Example 1
Input
s = "AppleIce"
Output
true

Explanation: The uppercase vowels are 'A' and 'I' (count = 2). The lowercase vowels are 'e' and 'e' (count = 2). Since the counts are equal, the output is true.

Example 2
Input
s = "HelloWorld"
Output
false

Explanation: The uppercase vowels count is 0. The lowercase vowels count is 3 ('e', 'o', 'o'). Since 0 is not equal to 3, the output is false.

Constraints

  • 1 <= s.length <= 10^5
  • s consists of English letters, digits, and punctuation marks.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free