标签:
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
Subscribe to see which companies asked this question
c++ code:
class Solution {
public:
    string reverseString(string s) {
        
        int len = s.length();
        int i=0,j=len-1;
        
        while(i<j) {
            s[i] ^= s[j] ^= s[i] ^= s[j];
            i++;
            j--;
        }
        return s;
    }
};标签:
原文地址:http://blog.csdn.net/itismelzp/article/details/51588257