This commit is contained in:
2022-11-30 18:20:36 +08:00
parent b13cfa00bb
commit 72555b19e0
132 changed files with 332 additions and 334 deletions

View File

@@ -1,6 +1,14 @@
#include "s0151_reverse_words_in_a_string.hpp"
string Solution::reverseWords(string s) {
void S0151::reverseSubStr(string &s, int begin, int end) {
for (; begin < end; ++begin, --end) {
char tmp = s[begin];
s[begin] = s[end];
s[end] = tmp;
}
}
string S0151::reverseWords(string s) {
if (s.length() == 0) {
return s;
}