Distance to the Nearest Zero in a Binary Grid
Asked at Snowflake · Coding Questions · Difficulty: Medium · Last asked Dec 30, 2025
A grid of cells holds only `0` and `1`. For every cell, find how many steps it takes to reach the nearest cell containing `0`, moving one step at a time up, down, left or right. Return all of these distances as a grid of the same shape.
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