NewThe Learning module is now liveSee what's new

(This question is a variation of the LeetCode question 723. Candy Crush. If you haven't completed that question yet, it is recommended to solve it first.)

You are given an integer matrix bubbles, where each positive integer represents a bubble color. Two cells are orthogonal neighbors when they share a side. For example, the highlighted cells below are the orthogonal neighbors of cell A.

Test Cases
Input
Output
Expected