We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Stepping Stones Game
Stepping Stones Game
Sort by
recency
|
68 Discussions
|
Please Login in order to post a comment
c#
public static string solve(long n)
Typescript -- time complexity O(1)!
It is interesting to observe the diversity of points of view and strategies discussed in the discussion of the game "Stepping Stones" on HackerRank. I have been following this conversation closely, as I have a friend who is quite knowledgeable in this area. She is always researching innovative algorithms and methods and her ideas were incredibly enlightening. One interesting idea she mentioned is optimizing the pathfinding algorithm by incorporating heuristics that guide traffic to the goal more efficiently.
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