Reverse string in C++ is accepted in "Run Code Result", but Submission gives "Wrong Answer". Not only this, but also Rotate image in Array also has the same issue.
class Solution {
public:
void reverseString(vector<char>& s) {
static int N = s.size();
for (int i = 0; i < N / 2; i++)
{
char temp = s[i];
s[i] = s[N-1-i];
s[N-1-i] = temp;
}
}
};
Test case:
["H","a","n","n","a","h"]
