Stepping Stones Game

  • + 0 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