1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/对角线遍历 II [diagonal-traverse-ii].html
2022-03-29 12:43:11 +08:00

43 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个列表&nbsp;<code>nums</code>&nbsp;,里面每一个元素都是一个整数列表。请你依照下面各图的规则,按顺序返回&nbsp;<code>nums</code>&nbsp;中对角线上的整数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/04/23/sample_1_1784.png" style="height: 143px; width: 158px;"></strong></p>
<pre><strong>输入:</strong>nums = [[1,2,3],[4,5,6],[7,8,9]]
<strong>输出:</strong>[1,4,2,7,5,3,8,6,9]
</pre>
<p><strong>示例 2</strong></p>
<p><strong><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/04/23/sample_2_1784.png" style="height: 177px; width: 230px;"></strong></p>
<pre><strong>输入:</strong>nums = [[1,2,3,4,5],[6,7],[8],[9,10,11],[12,13,14,15,16]]
<strong>输出:</strong>[1,6,2,8,7,3,9,4,12,10,5,13,11,14,15,16]
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>nums = [[1,2,3],[4],[5,6,7],[8],[9,10,11]]
<strong>输出:</strong>[1,4,2,5,3,8,6,9,7,10,11]
</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>nums = [[1,2,3,4,5,6]]
<strong>输出:</strong>[1,2,3,4,5,6]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10^5</code></li>
<li><code>1 &lt;= nums[i].length &lt;=&nbsp;10^5</code></li>
<li><code>1 &lt;= nums[i][j] &lt;= 10^9</code></li>
<li><code>nums</code>&nbsp;中最多有&nbsp;<code>10^5</code>&nbsp;个数字。</li>
</ul>