stones. Each turn, remove a perfect square number of stones (, , , ...). Can't move = lose. . for all (take all, opponent gets 0). Transition: . Try all valid square moves. Time: .
Time complexity: . For each state, try moves. No simple closed form like Nim or Divisor Game. Unlike Nim, this has no simple closed form. The DP is necessary to determine winning positions.
Space complexity: for the dp array.