2063. Vowels of All Substrings

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2063

class Solution:
    def countVowels(self, word: str) -> int:
        n = len(word)
        return sum((i + 1) * (n - i) for i, c in enumerate(word) if c in 'aeiou')