(int[] original, int m, int n)
| 1 | // matrix logic |
| 2 | class Solution { |
| 3 | public int[][] construct2DArray(int[] original, int m, int n) { |
| 4 | if(m*n != original.length){ |
| 5 | return new int[0][0]; |
| 6 | } |
| 7 | int index=0; |
| 8 | int res[][] = new int[m][n]; |
| 9 | for(int i=0;i<m;i++){ |
| 10 | for(int j=0;j<n;j++){ |
| 11 | res[i][j] = original[index]; |
| 12 | index++; |
| 13 | } |
| 14 | } |
| 15 | return res; |
| 16 | |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // maths logic |
nothing calls this directly
no outgoing calls
no test coverage detected