Stepping Stones Game

  • + 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;
    }