You are viewing a single comment's thread. Return to all comments →
def solve(n: int) -> int: left, right = 1, n while left <= right: mid = left + (right - left) // 2 step = mid * (mid + 1) // 2 if step == n: return "Go On Bob " + str(mid) elif step < n: left = mid + 1 else: right = mid - 1 return "Better Luck Next Time
Seems like cookies are disabled on this browser, please enable them to open this website
Stepping Stones Game
You are viewing a single comment's thread. Return to all comments →
def solve(n: int) -> int: left, right = 1, n while left <= right: mid = left + (right - left) // 2 step = mid * (mid + 1) // 2 if step == n: return "Go On Bob " + str(mid) elif step < n: left = mid + 1 else: right = mid - 1 return "Better Luck Next Time