Skip to content

Commit 8e136e9

Browse files
committed
atoi: corner cases..
1 parent 7568ccb commit 8e136e9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "../Header.h"
2+
3+
using namespace std;
4+
string reverseVowels(string s) {
5+
unordered_set<char> vows({'a','e','i','o','u','A','E','I','O','U'});
6+
int i = 0, j = s.length();
7+
while (i < j) {
8+
if (vows.find(s[i]) != vows.end()) {
9+
while (i < j && vows.find(s[j]) == vows.end()) j--;
10+
swap(s[i], s[j]);
11+
j--;
12+
}
13+
i++;
14+
}
15+
return s;
16+
}
17+
int main(int argc, char const *argv[])
18+
{
19+
return 0;
20+
}

0 commit comments

Comments
 (0)