Given a n x m grid filled with integers, find the subsquare with maximum sum among all submatrices.
Example:
Input: [ [ 1, -9, -10, 1], [-1, 10, 10, 1], [ 0, 9, 9, -9], [-1, 3, -1, -1] ] Output: 38 Explanation: 2x2 Submatrix [[10, 10], [9, 9]]
Note: A subsquare is a submatrix having the same number of columns and rows
Walkthroughs of the solution. Try the steps first, then watch to compare approaches.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check