Reverse String

2017/12/4 posted in  leetcode

class Solution {
public:
    string reverseString(string s) {
        int str = 0;
        int end = s.length()-1;
        while (str<=end) {
            char tmp;
            tmp = s[str];
            s[str] = s[end];
            s[end] = tmp;
            str++;
            end--;
        }
        return s;
    }
};