Skip to content

Commit

Permalink
Update minimum-garden-perimeter-to-collect-enough-apples.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Aug 1, 2021
1 parent 3a61af8 commit 92a14a0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions C++/minimum-garden-perimeter-to-collect-enough-apples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ class Solution2 {

int64_t x = pow(2 * neededApples, 1.0 / 3);
x -= x % 2;
assert((x - 2) * (x - 1) * x < 2 * neededApples);
assert(pow(x + 2, 3) >= 2 * neededApples);
assert((x - 2) * (x - 1) * x < 2 * neededApples && 2 * neededApples < pow(x + 2, 3));
x += 2;
if ((x - 2) * (x - 1) * x < 2 * neededApples) {
x += 2;
Expand Down

0 comments on commit 92a14a0

Please sign in to comment.