-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path2586.cpp
More file actions
47 lines (39 loc) · 1.17 KB
/
2586.cpp
File metadata and controls
47 lines (39 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/******************************************************************************
* 文件名: Code
* 作者: BOLUN XU
* 创建日期: 2025
* 版本: 1.0
* 描述: 。
* 时间复杂度:
* 空间复杂度:
* 执行用时:
* 消耗内存:
******************************************************************************/
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
using namespace std;
class Solution {
public:
int vowelStrings(vector<string>& words, int left, int right) {
int count = 0;
unordered_set<char> vowels = {'a', 'e', 'i', 'o', 'u'};
for (int i = left; i <= right; ++i) {
string word = words[i];
if (vowels.find(word[0]) != vowels.end() && vowels.find(word.back()) != vowels.end()) {
cout << "DEBUG: " << word << endl;
count++;
}
}
return count;
}
};
int main() {
Solution sol;
vector<string> words1 = {"are", "amy", "u"};
cout << sol.vowelStrings(words1, 0, 2) << endl;
vector<string> words2 = {"hey", "aeo", "mu", "ooo", "artro"};
cout << sol.vowelStrings(words2, 1, 4) << endl;
return 0;
}