mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
Merge pull request #2766 from ZaneCodeJourney/026.Python
0226翻转二叉树,删除冗余代码
This commit is contained in:
@ -459,7 +459,6 @@ class Solution:
|
|||||||
|
|
||||||
queue = collections.deque([root])
|
queue = collections.deque([root])
|
||||||
while queue:
|
while queue:
|
||||||
for i in range(len(queue)):
|
|
||||||
node = queue.popleft()
|
node = queue.popleft()
|
||||||
node.left, node.right = node.right, node.left
|
node.left, node.right = node.right, node.left
|
||||||
if node.left: queue.append(node.left)
|
if node.left: queue.append(node.left)
|
||||||
@ -1033,4 +1032,3 @@ public TreeNode InvertTree(TreeNode root) {
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user