C++ solution vector<vector<int>>
\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        vector<vector<int>> res(rows*col
```\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        vector<vector<int>> res(rows*cols);\n        \n        for(int i=0;i<rows;i++){\n            for(int j=0;j<cols;j++){\n                int boxNo=((i*cols)+j);\n                res[boxNo].push_back(i);\n                res[boxNo].push_back(j);\n            }\n        }\n        sort(res.begin(),res.end(),[rCenter,cCenter](vector<int> a,vector<int> b){\n            int d1=abs(a[0]-rCenter)+abs(a[1]-cCenter);\n            int d2=abs(b[0]-rCenter)+abs(b[1]-cCenter);\n            \n            return d1<d2;\n        });\n        return res;\n    }\n};\n```
[]