Largest Square House in java

You are given matrix 1's represent trees and 0's represent empty space, now you have to build a house in space such that it should form grid/square, then return the dimension of grid/square.




Input
4
5
1 1 1 0 0
1 1 1 0 0
0 1 0 1 0
0 0 1 1 1

Output: 2$2.

Input:
4
5
1 1 0 0 0
1 1 0 0 0
0 1 0 1 0
0 0 1 1 1

Output: 2$3.

first value indicates row and after $ indicates column.

Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Multiply Negative numbers in java