All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : June 04, 2024
Last updated : July 01, 2024
Related Topics : Array, Math, Geometry, Sorting, Matrix
Acceptance Rate : 71.86 %
# I'm sorry this is just funny to me lol
class Solution:
def allCellsDistOrder(self, rows: int, cols: int, rCenter: int, cCenter: int) -> List[List[int]]:
return sorted([[x, y] for x in range(0, rows) for y in range(0, cols)], key=lambda x: (abs(x[0] - rCenter) + abs(x[1] - cCenter)))