Solutions to high-frequency interview questions of LeetCode in C++17, taking into account both efficiency and comprehensibility.
class Solution {
public:
void reverseString(vector<char>& s) { reverse(s.begin(), s.end()); }
};
class Solution {
public:
void reverseString(vector<char>& s) {
int l = 0;
int r = s.size() - 1;
while (l < r) {
swap(s[l++], s[r--]);
}
}
};