s0226
This commit is contained in:
parent
038fa42883
commit
eb1bbfb9c6
9
src/s0226_invert_binary_tree.cpp
Normal file
9
src/s0226_invert_binary_tree.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "s0226_invert_binary_tree.hpp"
|
||||
|
||||
TreeNode *S0226::invertTree(TreeNode *root) {
|
||||
if (root == nullptr) return nullptr;
|
||||
TreeNode *tmp = root->left;
|
||||
root->left = invertTree(root->right);
|
||||
root->right = invertTree(tmp);
|
||||
return root;
|
||||
}
|
Loading…
Reference in New Issue
Block a user