qiaoxu123
11/18/2018 - 12:40 AM

344. Reverse String

简单地进行字符串的翻转

//Runtime: 56 ms, faster than 98.42%
//Memory Usage: 17.9 MB, less than 44.07%
class Solution {
public:
    void reverseString(vector<char>& s) {
        char temp;
        for(int i = 0; i< s.size() / 2;++i){
            temp = s[i];
            s[i] = s[s.size() - 1 - i];
            s[s.size() - 1 -i] = temp;
        }
    }
};