Skip to content

Commit 672ab7b

Browse files
Time: 15 ms (5.19%), Space: 9.8 MB (5.70%) - LeetHub
1 parent d6b2a4f commit 672ab7b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

invert-binary-tree/invert-binary-tree.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
class Solution {
1313
public:
1414
TreeNode* invertTree(TreeNode* root) {
15-
if(root)
16-
{
15+
if(root){
1716
invertTree(root->left);
1817
invertTree(root->right);
19-
std::swap(root->left,root->right);
20-
18+
swap(root->left,root->right);
2119
}
2220
return root;
23-
2421
}
2522
};

0 commit comments

Comments
 (0)