Problem

Source: Polish Math Olympiad 2023 2nd stage P2

Tags: combinatorics, grid



Let $n \geq 2$ be an integer. A lead soldier is moving across the unit squares of a $n \times n$ grid, starting from the corner square. Before each move to the neighboring square, the lead soldier can (but doesn't need to) turn left or right. Determine the smallest number of turns, which it needs to do, to visit every square of the grid at least once. At the beginning the soldier's back is faced at the edge of the grid.