MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / numMagicSquaresInside

Method numMagicSquaresInside

MagicSquaresInGrid.java:65–78  ·  view source on GitHub ↗
(int[][] grid)

Source from the content-addressed store, hash-verified

63 return false;
64 }
65 public int numMagicSquaresInside(int[][] grid) {
66 int rows = grid.length;
67 int cols = grid[0].length;
68 int count=0;
69 // rows * cols * (2 [3*3])
70 for(int i=0;i<rows-2;i++){
71 for(int j=0;j<cols-2;j++){
72 if(isMagicSquare(grid,i,j)){
73 count++;
74 }
75 }
76 }
77 return count;
78 }
79}

Callers

nothing calls this directly

Calls 1

isMagicSquareMethod · 0.95

Tested by

no test coverage detected