leetcode_cpp/string/344.cpp
2022-01-21 15:36:05 +08:00

22 lines
376 B
C++

/*
* @Description:
* @Version: 1.0
* @Autor: zhuyijun
* @Date: 2021-12-28 17:12:21
* @LastEditTime: 2022-01-21 15:35:19
*/
#include <bits/stdc++.h>
using namespace std;
void reverseString(vector<char>& s) {
if (s.size() < 2) {
return;
}
int l = 0, r = s.size() - 1;
while (l < r) {
char temp = s[r];
s[r] = s[l];
s[l] = temp;
l++, r--;
}
}