Pop Diagonal Bubbles with Gravity
Problem statement
Zero is empty. For each [row,column], do nothing if empty; otherwise remove the selected bubble and every same-valued immediate diagonal neighbor.
After each removal, compact bubbles downward in every column while preserving vertical order. Return the final board.
Function
popDiagonalBubbles(board: int[][], operations: int[][]) → int[][]Examples
Example 1
board = [[1,0,1],[0,1,0],[2,2,2]]operations = [[1,1]]return = [[0,0,0],[0,0,0],[2,2,2]]The center and four diagonal 1s are removed; twos stay at the bottom.
Example 2
board = [[1],[0]]operations = [[1,0]]return = [[1],[0]]Clicking empty does nothing.
Constraints
1 <= rows,columns,operations.length <= 200- Operation coordinates are in range.