C# Solution

  • 0
    public bool CanWinNim(int n) {
            if(n % 4 == 0) return false;
            return true;

    if total number of stones are in multiplication of 4, your opponent can use optimal strategy so you can end up with 4 stones and you are doomed.

    or else you can use the same strategy to make your opponent end up with stones with multiplication of 4 and make him doomed.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.