1954. Minimum Garden Perimeter to Collect Enough Apples
Содержание
class Solution:
def minimumPerimeter(self, neededApples: int) -> int:
l, r = 1, 100000
while l < r:
mid = (l + r) >> 1
if 2 * mid * (mid + 1) * (2 * mid + 1) >= neededApples:
r = mid
else:
l = mid + 1
return l * 8