(int grid[][], int r, int c)
| 51 | return -1; |
| 52 | } |
| 53 | public boolean isMagicSquare(int grid[][], int r, int c){ |
| 54 | int rowSum = findRowSum(grid,r,c); //3*3 |
| 55 | if(rowSum==-1) return false; |
| 56 | int colSum = findColSum(grid,r,c);//3*3 |
| 57 | if(colSum==-1) return false; |
| 58 | int diagonalSum = diagonalSum(grid,r,c); //const |
| 59 | if(diagonalSum==-1) return false; |
| 60 | if(rowSum==colSum && rowSum==diagonalSum){ |
| 61 | return true; |
| 62 | } |
| 63 | return false; |
| 64 | } |
| 65 | public int numMagicSquaresInside(int[][] grid) { |
| 66 | int rows = grid.length; |
| 67 | int cols = grid[0].length; |
no test coverage detected