(int[][] matrix)
| 19 | } |
| 20 | |
| 21 | public static Subsquare findSquare(int[][] matrix){ |
| 22 | assert(matrix.length > 0); |
| 23 | for (int row = 0; row < matrix.length; row++){ |
| 24 | assert(matrix[row].length == matrix.length); |
| 25 | } |
| 26 | |
| 27 | int N = matrix.length; |
| 28 | |
| 29 | for (int i = N; i >= 1; i--) { |
| 30 | Subsquare square = findSquareWithSize(matrix, i); |
| 31 | if (square != null) { |
| 32 | return square; |
| 33 | } |
| 34 | } |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | private static boolean isSquare(int[][] matrix, int row, int col, int size) { |
| 39 | // Check top and bottom border. |
no test coverage detected