mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
34 lines
1.2 KiB
HTML
34 lines
1.2 KiB
HTML
<p>给你一个大小为 <code>m x n</code> 的矩阵 <code>mat</code> 和一个整数阈值 <code>threshold</code>。</p>
|
||
|
||
<p>请你返回元素总和小于或等于阈值的正方形区域的最大边长;如果没有这样的正方形区域,则返回 <strong>0 </strong>。<br />
|
||
</p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/15/e1.png" style="height: 186px; width: 335px;" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</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
|
||
<strong>输出:</strong>2
|
||
<strong>解释:</strong>总和小于或等于 4 的正方形的最大边长为 2,如图所示。
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</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
|
||
<strong>输出:</strong>0
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</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><sup> </sup></li>
|
||
</ul>
|