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)/旋转矩阵 [rotate-matrix-lcci].html
2022-03-29 12:43:11 +08:00

46 lines
898 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>给你一幅由 <code>N × N</code> 矩阵表示的图像,其中每个像素的大小为 4 字节。请你设计一种算法,将图像旋转 90 度。</p>
<p>不占用额外内存空间能否做到?</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<pre>
给定 <strong>matrix</strong> =
[
[1,2,3],
[4,5,6],
[7,8,9]
],
<strong>原地</strong>旋转输入矩阵,使其变为:
[
[7,4,1],
[8,5,2],
[9,6,3]
]
</pre>
<p><strong>示例 2:</strong></p>
<pre>
给定 <strong>matrix</strong> =
[
[ 5, 1, 9,11],
[ 2, 4, 8,10],
[13, 3, 6, 7],
[15,14,12,16]
],
<strong>原地</strong>旋转输入矩阵,使其变为:
[
[15,13, 2, 5],
[14, 3, 4, 1],
[12, 6, 8, 9],
[16, 7,10,11]
]
</pre>
<p><strong>注意</strong>:本题与主站 48 题相同<a href="https://leetcode-cn.com/problems/rotate-image/">https://leetcode-cn.com/problems/rotate-image/</a></p>