Simple C++ solution without sort, storing distance of each cell
We use the dist vector to store all the cells corresponding to their distance from Center.\n\ndist[0] = {All cells at distance 0 from center}\ndist[1] = {All ce
We use the `dist` vector to store all the cells corresponding to their distance from Center.\n```\ndist[0] = {All cells at distance 0 from center}\ndist[1] = {All cells at distance 1 from center}\ndist[2] = {All cells at distance 2 from center}\n```\nand so on\n\n```\nvector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        \n        int max_dist = rows + cols + 1;\n        vector<vector<vector<int>>> dist(max_dist,vector<vector<int>>());\n        \n        for(int i=0; i<rows; i++) {\n            for(int j=0; j<cols; j++) {\n                int d = abs(rCenter-i) + abs(cCenter-j);\n                dist[d].push_back({i,j});\n            }\n        }\n        \n        vector<vector<int>> res;\n        \n        for(int i=0; i<max_dist; i++) {\n            for(auto v : dist[i])\n                res.push_back(v);\n        }\n        \n        return res;\n    }\n```
[]