mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-14 03:41:41 +08:00
add leetcode problem-cn part3
This commit is contained in:
33
算法题(国内版)/problem (Chinese)/转置矩阵 [transpose-matrix].html
Normal file
33
算法题(国内版)/problem (Chinese)/转置矩阵 [transpose-matrix].html
Normal file
@@ -0,0 +1,33 @@
|
||||
<p>给你一个二维整数数组 <code>matrix</code>, 返回 <code>matrix</code> 的 <strong>转置矩阵</strong> 。</p>
|
||||
|
||||
<p>矩阵的 <strong>转置</strong> 是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引。</p>
|
||||
|
||||
<p><img alt="" src="https://assets.leetcode.com/uploads/2021/02/10/hint_transpose.png" style="width: 600px; height: 197px;" /></p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>matrix = [[1,2,3],[4,5,6],[7,8,9]]
|
||||
<strong>输出:</strong>[[1,4,7],[2,5,8],[3,6,9]]
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>matrix = [[1,2,3],[4,5,6]]
|
||||
<strong>输出:</strong>[[1,4],[2,5],[3,6]]
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>m == matrix.length</code></li>
|
||||
<li><code>n == matrix[i].length</code></li>
|
||||
<li><code>1 <= m, n <= 1000</code></li>
|
||||
<li><code>1 <= m * n <= 10<sup>5</sup></code></li>
|
||||
<li><code>-10<sup>9</sup> <= matrix[i][j] <= 10<sup>9</sup></code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user