Distance from every desk to its nearest bathroom

0
Remix

An office floor plan is a grid of bathrooms, desks and open floor. For every desk, return how many steps (up, down, left, right) it takes to reach the closest bathroom. Expect follow-ups on a one-dimensional version, pairing desks with bathrooms globally, and floor plans that arrive row by row.

SnowflakeCodingMediumLast asked Jul 2026
No answer yet. Write the first one; the best answer gets endorsed.