Back to problems

Candy Crush 1D

Algorithm · Bloomberg · Hard

Requirements You receive a one-dimensional list of characters or numbers. Repeatedly delete every contiguous, largest possible block containing at least three identical values. Whenever deleting a block brings matching neighbors together, remove any newly created qualifying blocks as well. Produce the sequence that remains once no further deletions can occur. Common input forms include: A plain string or array, such as "xxxyyzd" or [4,4,4,7,7]. A run-length-encoded…

Checking your access…