AC Python solutions


  • 1

    The first one:

    def canWinNim(self, n):
        return n % 4 != 0
    

    The second one:

    def canWinNim(self, n):
        return bool(n % 4)
    

    The third one:

    ans = [False, True, True, True]
    def canWinNim(self, n):
        return Solution.ans[n % 4]
    

    All of them have the same results.

    # 60 / 60 test cases passed.
    # Status: Accepted
    # Runtime: 40 ms

Log in to reply
 

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