JavaScript: simple solution
\nvar allCellsDistOrder = function(rows, cols, r, c) {\n    let res = [];\n\t// add all cells\n    for (let i = 0; i<rows; i++) {\n        for (let j = 0; j<col
```\nvar allCellsDistOrder = function(rows, cols, r, c) {\n    let res = [];\n\t// add all cells\n    for (let i = 0; i<rows; i++) {\n        for (let j = 0; j<cols; j++)\n            res.push([i, j]);\n    }\n\t// sort cells by distance\n    res.sort((a, b)=>Math.abs(r-a[0]) + Math.abs(c-a[1]) - Math.abs(r-b[0]) - Math.abs(c-b[1]));\n    return res;\n};\n```
['JavaScript']