def minTotalDistance(self, grid):
        x = [i for i, row in enumerate(grid) for v in row if v == 1]
        y = [j for row in grid for j, v in enumerate(row) if v == 1]
        mid_x = self.findKthLargest(x, len(x) / 2 + 1)
        mid_y = self.findKthLargest(y, len(y) / 2 + 1)
        
        return sum([abs(mid_x-i) + abs(mid_y-j) \
                   for i, row in enumerate(grid) for j, v in enumerate(row) if v == 1])
:type grid: List[List[int]]
dataset/ETHPy150Open kamyu104/LeetCode/Python/best-meeting-point.py/Solution.minTotalDistance