Design ideas
The two-dimensional array of n*m is decomposed, decomposed into n one-dimensional arrays, and then the largest subarray of n one-dimensional arrays and note the subscript of the largest one-dimensional sub-array of each row, such as 2-5, which is divided into two cases the first is the largest sub-array between rows is connected, such as the first row is 2-5, the second row is 3-6, This is directly added to the line. The second is not connected, such as the first row is 2-5, the second row is 6-7, this time the largest sub-array of each row as a whole, and then make each of the largest array of blocks connected, so that the minimum cost of its connection. Finally, we can find out the maximum number of interconnected sub-arrays.
Feelings: Although the class with the teacher to talk about things have a little idea, but the programming time is still a bit difficult
Returns the and of the largest interconnected subarray in a two-dimensional array