1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 11:08:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/搜索二维矩阵 [search-a-2d-matrix].html

36 lines
1.3 KiB
HTML
Raw Normal View History

2023-12-09 18:42:21 +08:00
<p>给你一个满足下述两条属性的 <code>m x n</code> 整数矩阵:</p>
2022-03-27 20:56:26 +08:00
<ul>
2023-12-09 18:42:21 +08:00
<li>每行中的整数从左到右按非严格递增顺序排列。</li>
2022-03-27 20:56:26 +08:00
<li>每行的第一个整数大于前一行的最后一个整数。</li>
</ul>
2023-12-09 18:42:21 +08:00
<p>给你一个整数 <code>target</code> ,如果 <code>target</code> 在矩阵中,返回 <code>true</code> ;否则,返回 <code>false</code></p>
<p>&nbsp;</p>
2022-03-27 20:56:26 +08:00
<p><strong>示例 1</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/05/mat.jpg" style="width: 322px; height: 242px;" />
<pre>
<strong>输入:</strong>matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3
<strong>输出:</strong>true
</pre>
<p><strong>示例 2</strong></p>
<img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/11/25/mat2.jpg" style="width: 322px; height: 242px;" />
<pre>
<strong>输入:</strong>matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13
<strong>输出:</strong>false
</pre>
2023-12-09 18:42:21 +08:00
<p>&nbsp;</p>
2022-03-27 20:56:26 +08:00
<p><strong>提示:</strong></p>
<ul>
<li><code>m == matrix.length</code></li>
<li><code>n == matrix[i].length</code></li>
2023-12-09 18:42:21 +08:00
<li><code>1 &lt;= m, n &lt;= 100</code></li>
<li><code>-10<sup>4</sup> &lt;= matrix[i][j], target &lt;= 10<sup>4</sup></code></li>
2022-03-27 20:56:26 +08:00
</ul>