Skip to content

Commit e809798

Browse files
authored
Update split-message-based-on-limit.cpp
1 parent 71e41c5 commit e809798

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

C++/split-message-based-on-limit.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ class Solution {
66
public:
77
vector<string> splitMessage(string message, int limit) {
88
int cnt = 1, l = 1;
9-
for (int total = size(message) + 1, base = 1; 3 + l * 2 < limit && total + (3 + l) * cnt > limit * cnt;) {
9+
for (int total = size(message) + 1, base = 1; 3 + l * 2 < limit;) {
10+
if (total + (3 + l) * cnt <= limit * cnt) {
11+
break;
12+
}
1013
++cnt;
1114
if (cnt == 10 * base) {
1215
++l;

0 commit comments

Comments
 (0)