Hi, I'm trying to write a program in Java that when given an MxN matrix it will find the (contiguous) submatrix with the biggest sum of numbers. The program then needs to return the top left corner coordinates of the submatrix and the bottom right corner coordinates. The matrix can include negative numbers and both the matrix and submatrix don't need to be square.
I saw that this was discussed here: http://stackoverflow.com/questions/2643908/getting-the-submatrix-with-maximum-sum and the solution there seems to be O(n^3). A friend of mine said that they had once managed to solve this problem in O(n^2). Also suggested here. Is that possible?
Is there any available code out there that solves this problem in the most efficient way?