Stepping Stones Game

Sort by

recency

|

68 Discussions

|

  • + 0 comments

    c#

    public static string solve(long n)

    {
        string answer = "Better Luck Next Time";
        double moves = (double)(-1 + Math.Sqrt(1 + (8 * n)))/2;
        if (moves % 1 == 0)
        {
            answer = $"Go On Bob {moves}";
        }
        return answer;
    }
    
  • + 0 comments

    Typescript -- time complexity O(1)!

    function solve(n: number): string {
        const moves = (Math.sqrt(8 * n + 1) - 1) / 2;
        return Number.isInteger(moves) ? 'Go On Bob ' + moves : 'Better Luck Next Time';
    }
    
  • + 0 comments

    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.

  • + 3 comments
    def solve(n):
        # Write your code here
        delta = math.sqrt(1+8*n) - 1
        if delta%2: 
            return "Better Luck Next Time"
        return f"Go On Bob {int(delta//2)}"
    
  • + 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