C++ easy to understand, using multi map
\nclass Solution {\npublic:\n    int distance(int r, int c, int kr, int kc){\n        return (fabs(r - kr) + fabs(c - kc));\n    }\n    vector<vector<int>> allC
```\nclass Solution {\npublic:\n    int distance(int r, int c, int kr, int kc){\n        return (fabs(r - kr) + fabs(c - kc));\n    }\n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter)     {\n        multimap<int,vector<int>> s;\n        vector<vector<int>> vec;\n        for (int i = 0; i < rows; ++i)\n        {\n            for (int j = 0; j < cols; ++j)\n\t\t\t{\n                vector<int> v(2);\n                int d;\n                v[0] = i;\n                v[1] = j;\n                d = distance(i, j, rCenter, cCenter);\n                s.insert({d, v});\n            }\n        }\n        for (auto itr = s.begin(); itr != s.end(); ++itr)\n\t\t{\n            vec.push_back(itr->second);\n        }\n        return vec;\n    }\n};\n```\n**If you like it please upvote**
['C', 'Matrix']