Skip to content

Commit 2309e50

Browse files
committed
Runtime: 38 ms (Top 56.71%) | Memory: 11.1 MB (Top 20.60%)
1 parent 367283e commit 2309e50

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1+
// Runtime: 38 ms (Top 56.71%) | Memory: 11.1 MB (Top 20.60%)
12
class Solution {
23
public:
34
bool isVowel(char ch) {
45
return ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u';
56
}
6-
7+
78
long long countVowels(string word) {
89
long long count = 0;
910
int len = word.size();
10-
11+
1112
for(int pos = 0; pos < len; pos++) {
1213
if(isVowel(word[pos])) {
1314
count += (long)(len - pos) * (long)(pos + 1);
1415
}
1516
}
16-
17+
1718
return count;
1819
}
19-
};
20+
};

0 commit comments

Comments
 (0)