Fastest javascript solution | 92ms
Explanation\nThe approach is to go through each character of the string and check whether\xA0the character\xA0is a vowel or not.\nIf it\'s vowel then the number
**Explanation**\nThe approach is to go through each character of the string and check whether\xA0the character\xA0is a vowel or not.\nIf it\'s vowel then the number of new vowels added is equal to the number of new substrings added plus number vowels added in previous iterations;Else\xA0 number of new vowels added is number of vowels added in previous iterations;\xA0\n\nFor example for string "aba"\n1) "a"\xA0 \xA0 **New vowels** 1    **Result** 1  **Last Vowels** 0\n2) "ab"  "b"   \xA0 **New vowels** 0    **Result** 2   **Last Vowels** 1\n3) "aba" "ba" "a"  \xA0 **New vowels** 3    **Result** 6   **Last Vowels** 1\n\n```\n var countVowels = function (word) {\n    let lastVowels = 0;\n    let result = 0;\n    for (let i = 0; i < word.length; i++) {\n\t    let newVowels = 0;\n        if (isVowel(word[i])) {\n            newVowels= (i + 1);\n        }\n        result += lastVowels + newVowels;\n\t\tlastVowels = newVowels + lastVowels;\n    }\n    return result;\n};\nlet isVowel = function (char) {\n    return "aeiou".indexOf(char) !== -1 ? true : false;\n};
['Dynamic Programming', 'JavaScript']