Leetcode 3070. Count Submatrices with Top-Left Element and Sum Less Than k
Count how many submatrices that include the top-left cell (0,0) have sum ≤ k in an m×n matrix of nonnegative integers. Use the non-negativity and prefix sums (or two-pointer/monotonic expansion over bottom-right corners) to efficiently enumerate valid rectangles for m,n up to 1000.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.