标签:size ret solution while pre col public 反转 turn
1 class Solution 2 { 3 unordered_set<char> hash = {‘a‘,‘e‘,‘i‘,‘o‘,‘u‘,‘A‘,‘E‘,‘I‘,‘O‘,‘U‘}; 4 public: 5 string reverseVowels(string s) 6 { 7 int n = s.size(); 8 int begin = 0,end = n - 1; 9 while(begin < end) 10 { 11 while(begin < end && hash.count(s[begin]) == 0) begin ++; 12 while(begin < end && hash.count(s[end]) == 0) end --; 13 swap(s[begin ++],s[end --]); 14 } 15 return s; 16 } 17 };
标签:size ret solution while pre col public 反转 turn
原文地址:https://www.cnblogs.com/yuhong1103/p/12755269.html