Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Navigate a binary matrix from a given entrance to locate the closest border cell containing an open space.
Movement is restricted to horizontally or vertically adjacent open cells.
The entrance cell itself is explicitly excluded from being considered an exit.
What This Tests
Shortest path finding using Breadth-First Search
Grid traversal and boundary condition validation
Queue management and level-order exploration
Visited state tracking to avoid redundant processing
Common Patterns
BFS
Graph Traversal
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected