FastPrepPop Matching Balloon Neighborhoods
Problems/Pop Matching Balloon Neighborhoods

Pop Matching Balloon Neighborhoods

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report preserves positive color cells, one simultaneous round, centers with at least two same-color orthogonal neighbors, popping the center and matching neighbors, and column compaction. Zero and larger-row gravity are supplied explicitly, for an approximate 90% source match.

Positive integers are balloon colors and zero is empty. Evaluate one simultaneous popping round. A nonzero center triggers when at least two of its orthogonal neighbors have the same color; pop the center and every same-colored orthogonal neighbor of every triggering center.

After all pops, compact surviving balloons toward larger row indices within each column, preserving their order. Return the result.

Function

popBalloons(grid: int[][]) → int[][]

Examples

Example 1

grid = [[0,1,0],[1,1,1],[0,2,0]]return = [[0,0,0],[0,0,0],[0,2,0]]
grid
012001011112020
→
return
012000010002020
Moved or new

The center and its three matching neighbors pop before gravity.

Example 2

grid = [[1,1],[2,3]]return = [[1,1],[2,3]]
grid
01011123
→
return
01011123

One matching neighbor is insufficient.

Constraints

  • 1 <= rows, columns <= 200
  • 0 <= grid[r][c] <= 1000000000

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

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[][] popBalloons(int[][] grid) {
        // Write your code here.
    }

}
Checking account…