Min Obstacles to Allow Figure Fall
Reported by candidates from Meta's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
You've got a Meta OA in the next day or two and this one's a grid puzzle with a physics twist. A figure needs to fall through obstacles, and you're counting the minimum you need to remove. It's not a standard pathfinding problem, even though it looks like one at first. The trick is understanding what "fall" actually means in the context of the grid layout. StealthCoder will catch you if you freeze on the state representation, but the pattern itself is clean once you see it.
Pattern and pitfall
This is a simulation problem hiding a shortest-path structure. The figure falls under gravity, so you're not routing it like a typical grid search. Instead, you're simulating the fall mechanics and then asking: which obstacles, if removed, would let it reach the goal. That's a BFS or dynamic programming problem where the state is the figure's position after falling, and transitions are "remove obstacle X and re-simulate." The common pitfall is overthinking the physics or trying to brute-force all obstacle subsets. The real pattern is to model the fall as a deterministic function, then treat obstacle removal as the search dimension. StealthCoder's role is to help you code the simulation cleanly when the clock is ticking.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Min Obstacles to Allow Figure Fall cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Meta's OA.
Meta reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Min Obstacles to Allow Figure Fall FAQ
Is this a standard BFS grid problem?+
Not exactly. It looks like pathfinding, but the gravity mechanic changes everything. You're not moving freely; the figure falls until it hits an obstacle. Model the fall as a function, then search over which obstacles to remove.
What's the trick Meta is testing?+
Separating the physics simulation from the search logic. Many candidates conflate them and get tangled. Clean simulation, clean search, and the problem collapses. That's the insight Meta wants.
How do I handle the fall mechanic?+
For each state and direction, simulate the figure falling until it hits an obstacle or the grid boundary. Cache or recompute as needed. This is deterministic, so you can rely on it as a building block for BFS.
Do I need DP or BFS?+
BFS is natural because you're finding the minimum obstacles to remove. DP could work if you're memoizing subproblems, but BFS on the state space (position, obstacles removed) is more direct and easier to code under pressure.
What if I blank on the state representation?+
State is the figure's current position after simulating a fall. Transitions are removing one obstacle and re-simulating. Goal is reaching the target. Start simple, iterate, and let the simulation function carry the weight.