Skip to content
LC-0292 Easy LeetCode

292. Nim Game

Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 58% Topics: Math, Brainteaser, Game Theory
View full problem on LeetCode
Reference solution (spoiler · python)
# Time:  O(1)
# Space: O(1)

class Solution(object):
    def canWinNim(self, n):
        """
        :type n: int
        :rtype: bool
        """
        return n % 4 != 0

Solution from kamyu104/LeetCode-Solutions · MIT

Similar questions