2586. Count the Number of Vowel Strings in Range Easy

@problem@discussion
#Array#String#Counting



1/**
2 * [2586] Count the Number of Vowel Strings in Range
3 *
4 * You are given a 0-indexed array of string words and two integers left and right.
5 * A string is called a vowel string if it starts with a vowel character and ends with a vowel character where vowel characters are 'a', 'e', 'i', 'o', and 'u'.
6 * Return the number of vowel strings words[i] where i belongs to the inclusive range [left, right].
7 *  
8 * <strong class="example">Example 1:
9 * 
10 * Input: words = ["are","amy","u"], left = 0, right = 2
11 * Output: 2
12 * Explanation: 
13 * - "are" is a vowel string because it starts with 'a' and ends with 'e'.
14 * - "amy" is not a vowel string because it does not end with a vowel.
15 * - "u" is a vowel string because it starts with 'u' and ends with 'u'.
16 * The number of vowel strings in the mentioned range is 2.
17 * 
18 * <strong class="example">Example 2:
19 * 
20 * Input: words = ["hey","aeo","mu","ooo","artro"], left = 1, right = 4
21 * Output: 3
22 * Explanation: 
23 * - "aeo" is a vowel string because it starts with 'a' and ends with 'o'.
24 * - "mu" is not a vowel string because it does not start with a vowel.
25 * - "ooo" is a vowel string because it starts with 'o' and ends with 'o'.
26 * - "artro" is a vowel string because it starts with 'a' and ends with 'o'.
27 * The number of vowel strings in the mentioned range is 3.
28 * 
29 *  
30 * Constraints:
31 * 
32 * 	1 <= words.length <= 1000
33 * 	1 <= words[i].length <= 10
34 * 	words[i] consists of only lowercase English letters.
35 * 	0 <= left <= right < words.length
36 * 
37 */
38pub struct Solution {}
39
40// problem: https://leetcode.com/problems/count-the-number-of-vowel-strings-in-range/
41// discuss: https://leetcode.com/problems/count-the-number-of-vowel-strings-in-range/discuss/?currentPage=1&orderBy=most_votes&query=
42
43// submission codes start here
44
45impl Solution {
46    pub fn vowel_strings(words: Vec<String>, left: i32, right: i32) -> i32 {
47        0
48    }
49}
50
51// submission codes end
52
53#[cfg(test)]
54mod tests {
55    use super::*;
56
57    #[test]
58    fn test_2586() {
59    }
60}
61


Back
© 2025 bowen.ge All Rights Reserved.