Change Color of Squares in the Order Clicked — Animated Unwinding Color Sequence with 1-Second Delay
Render C number of 25px squares in a row. Each square has a black border and white background with 10px spacing. Clicking a square turns it green and records the click order. Once all C squares are green, an unwinding process automatically begins: squares revert to white one by one in the reverse order they were clicked, each with a 1-second delay between them. After the unwind completes the board resets and is ready for new clicks. Track click order using a queue/array in state; drive the unwind using recursive setTimeout calls. This was asked as a machine coding question for SDE2 at Uber.