292_NimGame - a920604a/leetcode GitHub Wiki


title: 292. Nim Game tags: - Math categories: leetcode comments: false

problem

solution

class Solution {
public:
    bool canWinNim(int n) {
        return n%4!=0;
    }
};

analysis

  • time complexity O(1)
  • space complexity O(1)