Brute force O(n log(n)) approach
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(nlog(n) + rows*cols)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(row * cols)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        vector<vector<int>> ans;\n        vector<pair<int, pair<int,int>>> v;\n\n        for(int i = 0; i < rows; ++i){\n            for(int j = 0; j < cols; ++j){\n                v.push_back({abs(i - rCenter) + abs(j - cCenter), {i, j}});\n            }\n        }\n\n        sort(v.begin(), v.end());\n\n        for(auto &i : v){\n            ans.push_back({i.second.first, i.second.second});\n        }\n        return ans;\n    }\n};\n```
['Sorting', 'C++']