Skip to content

Commit

Permalink
⚡ perf: improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuo committed Dec 3, 2018
1 parent 4fb1645 commit 95841bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AdvancedLevel_C++/1140. Look-and-say Sequence (20) .cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main() {
string t;
for (int i = 0; i < s.length(); i = j) {
for (j = i; j < s.length() && s[j] == s[i]; j++);
t += to_string((s[i] - '0')) + to_string(j - i);
t += s[i] + to_string(j - i);
}
s = t;
}
Expand Down
2 changes: 1 addition & 1 deletion BasicLevel_C++/1084. 外观数列 (20).cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main() {
string t;
for (int i = 0; i < s.length(); i = j) {
for (j = i; j < s.length() && s[j] == s[i]; j++);
t += to_string((s[i] - '0') * 10 + j - i);
t += s[i] + to_string(j - i);
}
s = t;
}
Expand Down

0 comments on commit 95841bc

Please sign in to comment.