Maximum subarray of size HxW within a 2D matrix
问题 Given a 2-dimensional array of positive integers, find the subrectangle of size HxW with the largest sum. The sum of a rectangle is the sum of all the elements in that rectangle. Input: A 2D array NxN with positive elements The HxW size of the subrectangle Output: The submatrix of HxW size with the largest sum of its elements. I've solved this using a brute-force method, however, I'm now looking for a better solution with better complexity (my brute-force method's complexity is O(n 6 )). 回答1: