This is my CPP solution.
class Solution {
public:
void reverseString(vector<char>& s) {
int n = s.size();
for(int i=0;i<n/2;i++){
swap(s[i],s[n-i-1]);
}
}
};
My Submissions on LeetCode
This is my CPP solution.
class Solution {
public:
void reverseString(vector<char>& s) {
int n = s.size();
for(int i=0;i<n/2;i++){
swap(s[i],s[n-i-1]);
}
}
};