0048. 旋转图像 #19
Replies: 8 comments 3 replies
-
致初学者: |
Beta Was this translation helpful? Give feedback.
-
请问为啥这里不需要一个中间变量存储matrix[i][j]也可以正常运行 |
Beta Was this translation helpful? Give feedback.
-
思路一基础思路不难,难的是后续能够写出来N+1,这玩意完全看运气 |
Beta Was this translation helpful? Give feedback.
-
补充一下为什么思路一是玄学,做对的偶然性很大 思路一(数学关系 + 演绎):
|
Beta Was this translation helpful? Give feedback.
-
思路二(数学关系 + 物理意义):
思路二难点在于有这样的数学直觉,其实说白了也是看经验。现在越来越感觉,计算机刷题的本质就是在积攒经验,到不至于说是背题,而是背诵遇到过的各种关键点(比如常见的双指针,不常见的如本题)。 |
Beta Was this translation helpful? Give feedback.
-
是不是有点写错了,文字写【水平翻转】但代码是竖直翻转。要么先转置再水平翻转,要么先竖直翻转再转置 |
Beta Was this translation helpful? Give feedback.
-
用嵌套列表推导式
|
Beta Was this translation helpful? Give feedback.
-
matrix = [[5,1,9,11],[2,4,8,10],[13,3,6,7],[15,14,12,16]] for i in range(n-1, -1, -1): print(res) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
0048. 旋转图像 | 算法通关手册
https://algo.itcharge.cn/Solutions/0001-0099/rotate-image/
Beta Was this translation helpful? Give feedback.
All reactions