Python solution: easy to understand
This code creates one list containing all possible cells and one list containing the cells\' distance from (r0,c0). Then, it sorts the two lists.\n\n\nclass Sol
This code creates one list containing all possible cells and one list containing the cells\' distance from (r0,c0). Then, it sorts the two lists.\n\n```\nclass Solution(object):\n    def allCellsDistOrder(self, R, C, r0, c0):\n        ans, dist = [], []\n        for r in range(R):\n            for c in range(C):\n                dist += [abs(r - r0) + abs(c - c0)]\n                ans += [[r, c]]\n        dist, ans = zip(*sorted(zip(dist, ans)))\n        return ans\n```
[]