2025-08-20 16:24:46 +0000 UTC

Count the Number of Vowel Strings in Range

Code

class Solution:
    def vowelStrings(self, words: List[str], left: int, right: int) -> int:
        res = 0
        vowels = ("a", "e", "i", "o", "u")
        for i in range(left, right + 1):
            word = words[i]
            if word[0] in vowels and word[-1] in vowels:
                res += 1
        return res