C# Solution (Nim Game)


  • 0
    A
    public bool CanWinNim(int n) {
             bool chanceToWin = false;
    
                int remainderOfFour = n % 4;
    
                if (remainderOfFour > 0)
                    chanceToWin = true;
    
                if (remainderOfFour == 0)
                    chanceToWin = false;
    
                return chanceToWin;
        }
    

Log in to reply
 

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