← ALL NOTES
Array

1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold

Find the maximum side length of a square submatrix whose element sum is ≤ threshold (0 if none). Two ideas combine: a 2D prefix sum to get any submatrix's sum in O(1), and binary search on the side…

Loading…