leetcode-Reverse String
反转字符串,
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = “hello”, return “olleh”.
string reverseString(string s) { if (s.size() == 0)return ""; int x = 0; int y = s.size() - 1; for (int i = 0; i < s.size() / 2; i++,x++,y--) { s[x] = s[x] ^ s[y]; s[y] = s[x] ^ s[y]; s[x] = s[x] ^ s[y];; } return s; }