✅C++ || Logic Explained || Simple Logic
\n\nLogic -> Distance of (i,j) from (rCen,cCen) == Distance of (rCen,cCen) from (i,j)\n\nn==size of map\nT->O(r * c) && S->O(n)\n\n\tclass Solution {\n\tpublic:
![image](https://assets.leetcode.com/users/images/39fd4dbf-fb2b-41ae-8188-6cad9d067b05_1657702669.1772947.png)\n\n***Logic -> Distance of (i,j) from (rCen,cCen) == Distance of (rCen,cCen) from (i,j)***\n\n**n==size of map\nT->O(r * c) && S->O(n)**\n\n\tclass Solution {\n\tpublic:\n\t\tvector<vector<int>> allCellsDistOrder(int r, int c, int rCen, int cCen) {\n\t\t\tvector<vector<int>>ans;\n\t\t\tmap<int,vector<vector<int>>>mp;\n\t\t\tfor(int i=0;i<r;i++){\n\t\t\t\tfor(int j=0;j<c;j++){\n\t\t\t\t\tint dis=abs(i-rCen)+abs(j-cCen);\n\t\t\t\t\tmp[dis].push_back({i,j});\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(auto i:mp){\n\t\t\t\tfor(auto j:i.second) ans.push_back(j);\n\t\t\t}\n\t\t\treturn ans;\n\t\t}\n\t};
['C', 'C++']