Problem Solution Python implementation 1234567 class : def canWinNim(self, n): """ :type n: int :rtype: bool """ return n % 4 != 0 Java implementation 12345 class { public boolean canWinNim(int n) { return n % 4 != 0; }} Time complexity O(1). Space complexity O(1). Links 292. Nim Game (中文版) 算法笔记: 力扣#292 Nim游戏 赞微海报分享
近期评论