Nim Game JavaScript Code - Easy


  • 0
    M

    var canWinNim = function(n) {

      if(n===1 || n===2 || n===3){
        return true;
      } else if( n%4 === 0){
        return false;
      } else{
        return true;
      }
    

    };

    canWinNim(7);


Log in to reply
 

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