Nearest Fire Station Distance for Every Residential Cell
Asked at LinkedIn · Coding Questions · Difficulty: Medium · Last asked Nov 10, 2026
A city is drawn as a rectangular grid. Some cells hold a fire station, some are lakes that nothing can cross, and the rest are residential cells. A fire truck drives one cell at a time to the cell directly above, below, left or right of it, and it can never enter a lake. For every residential cell, find how many moves the closest fire station is away.
Loading the problem…
More LinkedIn interview questions
- Design LinkedIn's Skills Extraction & Taxonomy Pipeline
- Stratified Sampling from Class-Bucketed Data
- Design Post Search with Keyword Exclusion and Frequency Ranking
- Ranked-Choice Voting (Instant Runoff)
- AI Personalized Recruiter Message Generation
- Real-Time Collaborative Code Editor