shlogg · Early preview
Md Ariful Haque @mah-shamim

Find Longest Substring With Even Vowel Counts In PHP

Find longest substring with even vowel counts using bitmask & hash table, O(n) time complexity.

1371. Find the Longest Substring Containing Vowels in Even Counts
Difficulty: Medium
Topics: Hash Table, String, Bit Manipulation, Prefix Sum
Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, 'a', 'e', 'i', 'o', and 'u' must appear an even number of times.
Example 1:

Input: s = "eleetminicoworoep"
Output: 13
Explanation: The longest substring is "leetminicowor" which contains two each of the vowels: e, i and o and zero of the vowels: a and u.

Example 2:

Input: s = "leetcodeisgreat"
Output: 5
Explanation: The longest substrin...