I'm having a bit of difficulty by solving an exercise, hope I can get some help from you. Given a 2D Array with N rows and M columns, and the array has only elements with the value 0 and 1. Find the largest surface that is similar to a chessboard(where 0 are the white squares and 1 the black squares) and print the size of the surface(number of squares).
Constraints: 2<=N<=1000 2<=M<=1000
Example: N=4, M=5
0 1 1 0 1
1 0 1 0 1
0 0 1 1 0
1 1 0 1 1
Output: Number of squares=5 (row 2-from column 1 to column 5)
Example: N=3, M=4
0 0 1 0
1 1 0 0
1 0 1 0
Output: Number of squares=6 (from row 1 to row 3- from column 2 to column 3)