pallets lists the cells where pallets stand at the start; a cell may hold several pallets.
Then moves happen one after another. On step i a forklift takes **all** pallets from cell from_cells[i] and puts them into cell to_cells[i]. At the moment of step i, cell from_cells[i] is guaranteed to hold at least one pallet.
Return the cells that hold at least one pallet after all moves, in increasing order.pallets=[3, 8, 8, 12], from_cells=[8, 3, 20], to_cells=[20, 12, 4] → [4, 12]
Both pallets from cell 8 go to 20, the one from 3 goes to 12, then both from 20 go to 4. Cells 4 and 12 are occupied.
pallets=[5, 6], from_cells=[5, 6], to_cells=[6, 5] → [5]
First everything gathers in cell 6, then all of it moves to cell 5.
pallets=[7], from_cells=[7], to_cells=[7] → [7]
Moving into the same cell changes nothing.
i, cell from_cells[i] is not emptypallets=[3, 8, 8, 12], from_cells=[8, 3, 20], to_cells=[20, 12, 4]
[4, 12]
Run checks the first 3 tests in your browser. Submit checks all 100 tests on the server, hidden ones included.