Refactor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user