LeetCode-Solutions-in-Cpp17

Solutions to high-frequency interview questions of LeetCode in C++17, taking into account both efficiency and comprehensibility.


Project maintained by downdemo Hosted on GitHub Pages — Theme by mattgraham
class Solution {
 public:
  void reverseString(vector<char>& s) { reverse(begin(s), end(s)); }
};
class Solution {
 public:
  void reverseString(vector<char>& s) {
    int l = 0;
    int r = size(s) - 1;
    while (l < r) {
      swap(s[l++], s[r--]);
    }
  }
};