Simple C++ solution | Custom comparator sorting
\nclass Solution {\npublic:\n    \n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) \n    {\n        int x=rCenter,y=cCen
```\nclass Solution {\npublic:\n    \n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) \n    {\n        int x=rCenter,y=cCenter;\n        vector<vector<int>>ans;\n        for(int i=0;i<rows;i++)\n        {\n            for(int j=0;j<cols;j++)\n            {\n                ans.push_back({i-x,j-y}); // pushing the coordinate by subtracting x and y\n            }\n        }\n        sort(ans.begin(),ans.end(),[](vector<int>&a, vector<int>&b)\n             {\n                 return (abs(a[0])+abs(a[1]))<(abs(b[0])+abs(b[1]));\n             });\n        int n=ans.size();\n        for(int i=0;i<n;i++)\n        {\n            ans[i][0]+=x;      // now adding x and y in the coordinates\n            ans[i][1]+=y;\n        }\n        return ans;\n    }\n};\n```\n1. Take all coordinates and substract with rCenter and cCenter and push the coordinates into array.\n2. Sort with custom comparator by taking abs values of individual item\n3. Now iterate the all coordinates and add rCenter and cCenter
[]