row:
- 'L': the tile was pushed to the left;
- 'R': it was pushed to the right;
- '.': the tile was left alone.
Every second, a tile falling left knocks its left neighbour over to the left, and a tile falling right knocks its right neighbour over to the right. If a standing tile is hit from both sides in the same second, the forces cancel and it stays upright. Pushes have no effect on tiles that are already falling or have fallen.
Return a string in the same format describing the final state of the row.row="R...L" → 'RR.LL'
The two end tiles fall towards each other. One second later their neighbours fall, and the middle tile is hit from both sides at once, so it stays upright.
row=".L..R." → 'LL..RR'
The L knocks over only tile 0 to its left, the R only the last tile. Nothing pushes the tiles in between.
row="RL.R" → 'RL.R'
row is 'L', 'R' or '.'row="R...L"
'RR.LL'
Run checks the first 3 tests in your browser. Submit checks all 165 tests on the server, hidden ones included.