Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1162. As Far from Land as Possible
Given an n×n grid of 0s (water) and 1s (land), find the water cell whose Manhattan distance to the nearest land cell is maximal and return that distance (return -1 if there is no land or no water). This is typically solved by computing nearest-land distances via a multi-source BFS from all land cells.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.