#NEWLINE# def canWinNim_MLE( self , n ) : #NEWLINE# #INDENT# '\n        dp\n\n        Let F[i] be the whether act & win when there is i stones left\n        :type n: int\n        :rtype: bool\n        ' #NEWLINE# if ( n < 3 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# F = [ False for _ in xrange ( ( n + 1 ) ) ] #NEWLINE# F [ 1 ] = F [ 2 ] = F [ 3 ] = True #NEWLINE# for i in xrange ( 4 , ( n + 1 ) ) : #NEWLINE# #INDENT# F [ i ] = any ( ( ( not F [ ( i - k ) ] ) for k in xrange ( 1 , 4 ) ) ) #NEWLINE# #UNINDENT# return F [ n ]