You are given a 2D grid of size
A
Your task is to return the minimum total travel distance to a meeting point. The total travel distance is the sum of the Manhattan distances between each friend’s home and the meeting point.
The Manhattan Distance between two points (x1, y1) and (x2, y2) is calculated as:|x2 - x1| + |y2 - y1|.
Constraints:
grid.length
grid[i].length
grid[i][j] is either 0 or 1.
There will be at least two friends in the grid.
You are given a 2D grid of size
A
Your task is to return the minimum total travel distance to a meeting point. The total travel distance is the sum of the Manhattan distances between each friend’s home and the meeting point.
The Manhattan Distance between two points (x1, y1) and (x2, y2) is calculated as:|x2 - x1| + |y2 - y1|.
Constraints:
grid.length
grid[i].length
grid[i][j] is either 0 or 1.
There will be at least two friends in the grid.