1. Code
class Solution:
def canWinNim(self, n: int) -> bool:
# If I make the opponent get a multiple of 4, I win and if I get a multiple of 4, I lose.
return False if n%4 == 0 else True
2. Result
Runtime : 20 ms(98.28%), Memory usage : 14.1 MB(82.97%)
(Runtime can be different by a system even if it is a same code.)