1371. Find the Longest Substring Containing Vowels in Even Counts Medium

@problem@discussion
#Hash Table#String#Bit Manipulation#Prefix Sum



1/**
2 * [1371] Find the Longest Substring Containing Vowels in Even Counts
3 *
4 * 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.
5 *  
6 * Example 1:
7 * 
8 * Input: s = "eleetminicoworoep"
9 * Output: 13
10 * 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.
11 * 
12 * Example 2:
13 * 
14 * Input: s = "leetcodeisgreat"
15 * Output: 5
16 * Explanation: The longest substring is "leetc" which contains two e's.
17 * 
18 * Example 3:
19 * 
20 * Input: s = "bcbcbc"
21 * Output: 6
22 * Explanation: In this case, the given string "bcbcbc" is the longest because all vowels: a, e, i, o and u appear zero times.
23 * 
24 *  
25 * Constraints:
26 * 
27 * 	1 <= s.length <= 5 x 10^5
28 * 	s contains only lowercase English letters.
29 * 
30 */
31pub struct Solution {}
32
33// problem: https://leetcode.com/problems/find-the-longest-substring-containing-vowels-in-even-counts/
34// discuss: https://leetcode.com/problems/find-the-longest-substring-containing-vowels-in-even-counts/discuss/?currentPage=1&orderBy=most_votes&query=
35
36// submission codes start here
37
38impl Solution {
39    pub fn find_the_longest_substring(s: String) -> i32 {
40        0
41    }
42}
43
44// submission codes end
45
46#[cfg(test)]
47mod tests {
48    use super::*;
49
50    #[test]
51    fn test_1371() {
52    }
53}
54


Back
© 2025 bowen.ge All Rights Reserved.