Shortest Path in a Hidden Grid
A medium-tier problem at 44% community acceptance, tagged with Array, Depth-First Search, Breadth-First Search. Reported in interviews at Meta and 0 others.
Shortest Path in a Hidden Grid is the kind of problem that ambushes candidates who've only drilled standard BFS. Meta asks it. You don't get the grid upfront. You have to explore it, probe it, figure out its bounds and obstacles by making calls. The acceptance rate sits at 44 percent, which means a lot of people freeze when they realize the grid itself is hidden. You can't just throw your memorized BFS template at it. If you hit this on a live assessment and the interactive nature throws you, StealthCoder surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Shortest Path in a Hidden Grid"
Shortest Path in a Hidden Grid is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.
Get StealthCoderThe trap is mistaking this for a normal shortest-path problem. You don't have the grid. You have an API or query function that tells you whether a cell is walkable. The real challenge is implementing a proper BFS or DFS that explores the hidden grid efficiently, respects the bounds you discover, and tracks visited cells so you don't loop forever. Most candidates either write BFS without understanding the interactive constraint, or they overthink state management and time out. The core pattern is BFS with memoization of discovered cells. You call the grid function, cache results, and expand outward layer by layer. StealthCoder's value here is massive because the interactivity changes the whole problem's shape. Even if you know BFS cold, the hidden-grid twist breaks your instinct.
Pattern tags
You know the problem.
Make sure you actually pass it.
Shortest Path in a Hidden Grid recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Shortest Path in a Hidden Grid interview FAQ
Is this actually asked at Meta?+
Yes. It's the only major company in the input data. That said, it's a medium-difficulty interactive problem, so it may appear in early-stage phone screens or online assessments rather than final rounds. The 44 percent acceptance rate suggests it's not trivial.
What's the actual trick?+
You can't preload the grid. You discover it by querying a function. Standard BFS still works, but you must cache every cell you've queried to avoid redundant calls and infinite loops. The hidden aspect makes it feel novel, but the algorithm underneath is BFS with a memoization layer.
How does the interactive part change my approach?+
Instead of reading a 2D array, you call a function for each cell. This means you're exploring the grid incrementally. You need to track which cells you've already queried, handle boundary cases gracefully, and ensure your BFS doesn't revisit cells unnecessarily.
Should I use DFS or BFS for shortest path?+
BFS guarantees shortest path in an unweighted grid. DFS does not. Since this is framed as a shortest-path problem, BFS is the right choice. DFS might work for exploration, but it won't give you the optimal distance.
What's the acceptance rate telling me?+
44 percent is below median for medium problems. It means either the interactivity throws people off, or there's a subtle state-management bug many candidates hit. Expect tricky edge cases around grid bounds and cell visibility.
Want the actual problem statement? View "Shortest Path in a Hidden Grid" on LeetCode →