Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Can you show an example? What would fromTo and result be if the row were [0,1,0,1] and why? Commented Feb 19, 2018 at 21:33
  • I added a few examples. The first one will have [-1,0,-1,0] for fromTo. The -1 are default values which are not touched when there is no block at that initial position. The two zeroes indicate that the blocks at positions 1 and 3 will both go to position 0 (where they will merge). result will reflect this merge in the first position: [2,0,0,0]. The other zeroes are default values indicating that that position will be empty. Commented Feb 19, 2018 at 21:40