Nearest Fire Station Distance for Each Residential Area (with Lakes)

Given an m x n grid where 0 is a fire station, -2 is a lake (fire trucks cannot pass through) and -1 is a residential area. There may be multiple fire stations. A truck moves one step at a time ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: