Class Solution
java.lang.Object
g1201_1300.s1292_maximum_side_length_of_a_square_with_sum_less_than_or_equal_to_threshold.Solution
1292 - Maximum Side Length of a Square with Sum Less than or Equal to Threshold.<p>Medium</p>
<p>Given a <code>m x n</code> matrix <code>mat</code> and an integer <code>threshold</code>, return <em>the maximum side-length of a square with a sum less than or equal to</em> <code>threshold</code> <em>or return</em> <code>0</code> <em>if there is no such square</em>.</p>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2019/12/05/e1.png" alt="" /></p>
<p><strong>Input:</strong> mat = [[1,1,3,2,4,3,2],[1,1,3,2,4,3,2],[1,1,3,2,4,3,2]], threshold = 4</p>
<p><strong>Output:</strong> 2</p>
<p><strong>Explanation:</strong> The maximum side length of square with sum less than 4 is 2 as shown.</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> mat = [[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2],[2,2,2,2,2]], threshold = 1</p>
<p><strong>Output:</strong> 0</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>m == mat.length</code></li>
<li><code>n == mat[i].length</code></li>
<li><code>1 <= m, n <= 300</code></li>
<li><code>0 <= mat[i][j] <= 10<sup>4</sup></code></li>
<li><code>0 <= threshold <= 10<sup>5</sup></code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
maxSideLength
public int maxSideLength(int[][] mat, int threshold)
-