class Solution { public: void reverseString(vector<char>& s) { string str = ""; for(int i = s.size()-1; i >= 0; i--) { str+= s[i]; } for(int i = 0; i < s.size(); i++) { s[i] = str[i]; } } };
void reverseString(vector<char>& s) { int i = 0, j = s.size() - 1; while (i < j) swap(s[i++], s[j--]); }