Practice Bricks Falling When Hit
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
grid uses 1 for a brick and 0 for empty space. A brick is stable when it lies in the top row or connects to that row through horizontally or vertically adjacent bricks. Apply hits in order. Remove the hit brick if present, then remove other bricks that lose stability; fallen bricks disappear rather than landing below. For each hit, return the number of other bricks that fall, excluding the directly removed brick. Hitting an empty cell drops none.
Source: Bricks Falling When Hit on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
grid = [[1,0,0,0],[1,1,1,0]], hits = [[1,0]]
[2]
# Example 2
grid = [[1,0,0,0],[1,1,0,0]], hits = [[1,1],[1,0]]
[0,0]
Constraints
Related LeetCode Problems
Practice more problems similar to Bricks Falling When Hit.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.