Grokking Meta Coding Interview
Ask Author
Back to course home

0% completed

Solution: Best Meeting Point

Problem Statement

You are given m x n matrix containing 1 and 0 digits only, where each 1 represents the home of one friend, return the minimum total travel distance.

The minimal total travel distance is defined as a sum of distances between each friend's house and meeting point. Here, you need to find the meeting point such that it should have minimal distance from the home of each friend.

The distance is calculated as the Manhattan distance, which is the sum of the absolute differences in the horizontal and vertical coordinates `(distance(a1, a2) = |a2.x - a1.x| + |a2

.....

.....

.....

Like the course? Get enrolled and start learning!