Misere Nim — Solution & Editorial
If every pile is at most 1, the first player wins iff the number of size-1 piles is even; otherwise the normal-play XOR rule applies.
Complexity: O(K)
Watch out: The special case is only when all piles are ≤ 1.
If every pile is at most 1, the first player wins iff the number of size-1 piles is even; otherwise the normal-play XOR rule applies.
Complexity: O(K)
Watch out: The special case is only when all piles are ≤ 1.