According to Sprague-Grundy theorem each state of an impartial game can be assigned a non-negative integer called Grundy number, such that the player who moves in this state will lose iff this number is 0, and win iff this number is non-zero. If the Grundy numbers for the states are...

Turns out I misunderstood the solution. Here's the complete solution: def firstWillWin(self, values): """ :param values: a list of integers :return: a boolean which equals to True if the first player will win """ n = len(values) if n%2 == 0 and self.firstWillWinEven(values): return True return self.firstWillWinNormalCase(values) If odd_s !=...