MCPcopy Index your code
hub / github.com/careercup/ctci / findSquare

Method findSquare

java/Chapter 18/Question18_11/Question.java:21–36  ·  view source on GitHub ↗
(int[][] matrix)

Source from the content-addressed store, hash-verified

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.

Callers 1

mainMethod · 0.95

Calls 1

findSquareWithSizeMethod · 0.95

Tested by

no test coverage detected