Skip to content

Commit

Permalink
Merge pull request #53 from MrcRjs/MrcRjs-patch-19
Browse files Browse the repository at this point in the history
Create lt-reverse-string.cpp
  • Loading branch information
MrcRjs authored Jan 31, 2022
2 parents 8c44fea + ba1a4d7 commit 7b02a39
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lt-reverse-string.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
public:
void reverseString(vector<char>& s) {
int n = s.size() - 1;
for(int i = 0; i <= n / 2; i++) {
char t = s[n - i];
s[n - i] = s[i];
s[i] = t;
}
}
};

0 comments on commit 7b02a39

Please sign in to comment.