Algorithm · Citadel · Medium
Requirements This task has two components. Simulate tile movement. Given a 4x4 board whose entries are either zero or powers of two, implement moves in the four directions: left, right, up, and down. A move shifts every tile toward the selected edge. Whenever two equal neighboring tiles meet, combine them into one tile with twice the value. Each tile may take part in no more than one merge during a single move, and empty positions are filled from the rear. Encode the board.…
Checking your access…