LC: 317. Shortest Distance from All Buildings
https://leetcode.com/problems/shortest-distance-from-all-buildings/
Input: grid = [[1,0,2,0,1],[0,0,0,0,0],[0,0,1,0,0]]
Output: 7
Explanation: Given three buildings at (0,0), (0,4), (2,2), and an obstacle at (0,2).
The point (1,2) is an ideal empty land to build a house, as the total travel distance of 3+3+1=7 is minimal.
So return 7.Input: grid = [[1,0]]
Output: 1PreviousLC: 311. Sparse Matrix MultiplicationNextLC: 323. Number of Connected Components in an Undirected Graph
Last updated
