File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -459,11 +459,10 @@ class Solution:
459459
460460 queue = collections.deque([root])
461461 while queue:
462- for i in range (len (queue)):
463- node = queue.popleft()
464- node.left, node.right = node.right, node.left
465- if node.left: queue.append(node.left)
466- if node.right: queue.append(node.right)
462+ node = queue.popleft()
463+ node.left, node.right = node.right, node.left
464+ if node.left: queue.append(node.left)
465+ if node.right: queue.append(node.right)
467466 return root
468467
469468```
@@ -1033,4 +1032,3 @@ public TreeNode InvertTree(TreeNode root) {
10331032<a href =" https://programmercarl.com/other/kstar.html " target =" _blank " >
10341033 <img src =" ../pics/网站星球宣传海报.jpg " width =" 1000 " />
10351034</a >
1036-
You can’t perform that action at this time.
0 commit comments