JAVA EASY SOLUTION [ SORTING ]
\nclass Node{\n    int i,j,distance;\n    Node(int i,int j,int distance){\n        this.i=i;\n        this.j=j;\n        this.distance=distance;\n    }\n}\n\n\n
```\nclass Node{\n    int i,j,distance;\n    Node(int i,int j,int distance){\n        this.i=i;\n        this.j=j;\n        this.distance=distance;\n    }\n}\n\n\nclass Solution {\n    ArrayList<Node> list=new ArrayList<>();\n    public int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n    \n        for(int i=0;i<rows;i++) for(int j=0;j<cols;j++) list.add(new Node(i,j,Math.abs(rCenter-i)+Math.abs(cCenter-j)));\n        Collections.sort(list,(a,b)->a.distance-b.distance);\n        int result[][]=new int[list.size()][2];\n        for(int i=0;i<list.size();i++)\n        {\n            result[i][0]=list.get(i).i;\n            result[i][1]=list.get(i).j;\n        }\n        return result;      \n    }\n}\n```
[]