Sort coordinates - Python
Sort by:\n1) layer = max(Δr, Δc)\n2) right-bottom half before left-top half\n3) By r and c (increasing or decreasing depending on the half)\n\ndef spiralMatrixI
Sort by:\n1) layer = max(&Delta;r, &Delta;c)\n2) right-bottom half before left-top half\n3) By r and c (increasing or decreasing depending on the half)\n```\ndef spiralMatrixIII(self, R, C, r0, c0):\n    return sorted([[r, c] for r in range(R) for c in range(C)],\n                  key=lambda (r, c): (max(abs(r - r0), abs(c - c0)),\n                                      (0, r, -c) if r + c > r0 + c0 else (1, -r, c)))\n```\nWritten after seeing @lee215\'s title "[Sort All Coordinates](https://leetcode.com/problems/spiral-matrix-iii/discuss/158971/Python-Sort-All-Coordinates)" but before looking at its code.
[]