This question evaluates modeling and optimization of discrete state-space transitions under movement constraints, testing combinatorial reasoning, reachability, and resource-maximization competencies.
You are given a 1D board of length N. Each cell is in one of three states:
In one move, you may choose any one piece and move it exactly 3 cells to the right (from index i to i+3). The move rules are:
i+3
is outside the board.
You may perform moves in any order, for as many turns as you like, until no piece can legally move.
Return the maximum number of coins you can collect.
N
) containing exactly one of
{empty, piece, coin}
per cell.