Back to problems

Bubble Explosion on a Grid (One Round + Gravity)

Algorithm · Pinterest · Medium

You receive a two-dimensional integer array bubbles, where bubbles[r][c] denotes the color assigned to the bubble at that position. At the start, the board has a bubble in every location. Cells count as adjacent when they share an edge, meaning only the four cardinal directions—above, below, left, and right—are considered. Simulate exactly one explosion round according to these conditions: A bubble qualifies for detonation when at least two of its side-adjacent neighbors…

Checking your access…