C# Priority Queue Solution
Code\n\npublic class Solution {\n    public int[][] AllCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        PriorityQueue<int[], int> pq = ne
# Code\n```\npublic class Solution {\n    public int[][] AllCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        PriorityQueue<int[], int> pq = new PriorityQueue<int[], int>();\n        for (int i = 0; i < rows; i++)\n        {\n            for (int j = 0; j < cols; j++)\n            {\n                pq.Enqueue(new int[] { i, j }, Math.Abs(i - rCenter) + Math.Abs(j - cCenter));\n            }\n        }\n        int[][] res = new int[rows * cols][];\n        int count = 0;\n        while (pq.Count > 0)\n        {\n            res[count] = pq.Dequeue();\n            count++;\n        }\n        \n        return res;\n    }\n}\n```
['C#']