Closest Bathroom / Desk on a Grid
Asked at Snowflake · Coding Questions · Difficulty: Medium · Last asked Jul 1, 2026
Given a 2-D grid with cells marked `B` (bathroom), `D` (desk), and `_` (empty), return the shortest 4-directional step distance from each cell to its nearest bathroom. Bathroom cells are distance 0; unreachable cells are -1.
Loading the problem…
More Snowflake interview questions
- Design a Distributed Job Scheduler with Cron, Pause, Resume
- Design an ACL Authorization Service
- Design an S3-Style Blob Store with Deduplication
- SQL: Project Duration & Budget per Employee
- Cross-Platform Client Logging Library
- Design a Quota System