Skip to content

292_NimGame

a920604a edited this page Apr 14, 2023 · 1 revision

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

solution

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

analysis

  • time complexity O(1)
  • space complexity O(1)
Clone this wiki locally