Python 3 solution with dict, beats 100%
The idea is to use distances as a dict key. Then get the cells by looping through the dict keys.\n\n\nfrom collections import defaultdict\n\nclass Solution:\n  
The idea is to use distances as a dict key. Then get the cells by looping through the dict keys.\n\n```\nfrom collections import defaultdict\n\nclass Solution:\n    def allCellsDistOrder(self, R: int, C: int, r0: int, c0: int) -> List[List[int]]:\n        i = 0\n        dist = defaultdict(list)\n        \n        while i < R:\n            j = 0\n            while j < C:\n                d = abs(r0 - i) + abs(c0 - j)\n                dist[d].append((i,j))\n                j += 1\n            i += 1\n            \n        i = 0\n        res = []\n        while i <= (R + C):\n            if i in dist:\n                res += dist[i]\n            i += 1\n                \n        return res\n```
['Python']