def canWinNim_TLE(self, n):
        if n < 3:
            return True

        F = [False for _ in xrange(3)]
        F[1] = F[2] = F[0] = True
        for i in xrange(4, n+1):
            F[i%3] = any(not F[(i-k)%3] for k in xrange(1, 4))

        return F[n%3]
dp
dataset/ETHPy150Open algorhythms/LeetCode/292 Nim Game.py/Solution.canWinNim_TLE