Quite easily done
Intuition\n Describe your first thoughts on how to solve this problem. \ncreate an array with the values from 0 to max value, where max value is the addition va
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\ncreate an array with the values from 0 to max value, where max value is the addition value obtained after performing subtraction between row and column indices.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(N^4)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(2*N^2)\n\n# Code\n```\nclass Solution {\n    public int[][] allCellsDistOrder(int rows, int cols, int rCenter, int cCenter) {\n        int [][] arr = new int[rows][cols];\n        int num=0;\n       \n            //filling values inside the array\n                for(int i=0 ; i<rows ; i++){\n                    for(int j=0 ; j<cols ; j++){\n                    arr[i][j]=Math.abs(i-rCenter)+Math.abs(j-cCenter);\n                    }\n                }\n           int max=arr[0][0];\n           //finding the maximum value in the array\n           for(int i=0 ; i<arr.length ; i++){\n                for(int j=0 ; j<arr[0].length ; j++){\n                    if(arr[i][j]>max){\n                        max=arr[i][j];\n                    }\n                }\n           }\n             int [][] rvalue = new int[rows*cols][2];\n             int index=0;\n           while(num<=max){\n               for(int l=0 ; l<arr.length ; l++){\n                    for(int m=0 ; m<arr[0].length ; m++){\n                        if(arr[l][m]==num){\n                            rvalue[index][0]=l;\n                            rvalue[index][1]=m;\n                            index++;\n                        }\n                        \n                    }\n                }\n                num++;\n           }\n      return rvalue;\n    }\n}\n```
['Java']