← 返回 capitalone 的题目列表Bubble Elimination in Matrix
类型:online_judge
In a matrix bubbles, clicking on a position (x, y) removes that bubble and its diagonal adjacent bubbles of the same color (top-left, top-right, bottom-left, bottom-right). After popping, the bubbles above should fall down to fill the empty spaces. After several operations, return the final matrix.
Input: bubbles = [ [1, 1, 0], [1, 0, 0], [0, 0, 1] ] Clicks = [(0, 0)] Output: [[1, 0, 0], [0, 0, 0], [0, 0, 1]]
The bubble matrix is m x n, where both m and n do not exceed 50.
Example
Input
bubbles = [[1, 1, 0], [1, 0, 0], [0, 0, 1]], clicks = [(0, 0)]