Pop Diagonal Bubbles with Gravity
Updated
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]]Moved or new
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.
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Rotate Matrix Regions Around the DiagonalsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- Rotate Matrix Regions Around the DiagonalsHudson River Trading · OAHudson River Trading interview questions
- Robot Navigation Around LasersRoblox · OARoblox interview questions
- Leaves Remaining After Wind GustsOpenAI · OAOpenAI interview questions
- Apply a Reversi MoveAmazon · OA
- Flip, Invert, and Smooth a Binary ImageAbridge · OAAbridge interview questions
- Count Straight-Line Word Occurrences in a GridOptiver · OAOptiver interview questions
- First Completed Mingo LineEpic · OAEpic interview questions
- Sort Every Matrix Border LayerCapital One · OACapital One interview questions
- Rotate a Square Matrix ClockwiseVisa · OAVisa interview questions