public static void main(String args[]) {
        BestMeetingPoint bmp = new BestMeetingPoint();
        int[][] grid = {{1, 0, 0, 0, 1}, {0, 0, 0, 0, 0},{0, 0, 1, 0, 0}};
        System.out.print(bmp.minTotalDistance(grid));
    }
Date 03/24/2016
@author Tushar Roy

A group of two or more people wants to meet and minimize the total travel distance.
You are given a 2D grid of values 0 or 1, where each 1 marks the home of someone in the group.
The distance is calculated using Manhattan Distance, where distance(p1, p2) = |p2.x - p1.x| + |p2.y - p1.y|.
Find the total distance that needs to be travelled to reach this meeting point.

Time complexity O(m*n)
Space complexity O(m + n)

https://leetcode.com/problems/best-meeting-point/
src/com/interview/array/BestMeetingPoint.java