Given an m n integer matrix board representing a grid of candies, where each positive integer represents a distinct candy type and
Identify all groups of
Crush all identified candies simultaneously by changing their values to
Apply gravity so that the remaining candies in each column drop down to fill the empty spaces below them. Any empty spaces left at the top of the columns are filled with
Repeat steps
Return the final state of board after the grid reaches a stable configuration.
Constraints:
m board.length
n board[i].length
m, n
board[i][j]
Given an m n integer matrix board representing a grid of candies, where each positive integer represents a distinct candy type and
Identify all groups of
Crush all identified candies simultaneously by changing their values to
Apply gravity so that the remaining candies in each column drop down to fill the empty spaces below them. Any empty spaces left at the top of the columns are filled with
Repeat steps
Return the final state of board after the grid reaches a stable configuration.
Constraints:
m board.length
n board[i].length
m, n
board[i][j]