Provided a 2D matrix of 0 and 1, check if triangle can be formed using continuous 1's.
If possible return it's perimeter. Otherwise return -1
eg.
0 0 0 0 1
0 0 0 1 1
0 0 1 1 1
0 1 1 1 1
Perimeter in this case is 9.
Can someone help me with the solution of this? I just can't understand this problem