Skip to content

Commit f382930

Browse files
committed
Time: 24 ms, Memory: 23.3 MB - LeetHub
1 parent 8a6bf73 commit f382930

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: reverse-string/reverse-string.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution {
2+
public:
3+
void reverseString(vector<char>& s) {
4+
auto left = 0, right = int(s.size()) -1;
5+
while(left < right) {
6+
swap(s[left++],s[right--]);
7+
}
8+
}
9+
};

0 commit comments

Comments
 (0)