Skip to content

Commit

Permalink
Update 881.Boats-to-Save-People_v3.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Dec 4, 2019
1 parent 327fbbb commit 7b75f9b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class Solution {
count++;
p[x]--;

while (y+x<=limit && p[y]==0) y++;
if (y+x<=limit && p[y]>0) p[y]--;
while (y+x<=limit && p[y]==0)
y++;
if (y+x<=limit && p[y]>0)
p[y]--;
}

return count;
Expand Down

0 comments on commit 7b75f9b

Please sign in to comment.