226. Invert Binary Tree easy題
二差樹歷遍而已
難得我會
但我runtime跟memory超爛
是要改迭代比較好嗎
class Solution {
public:
TreeNode* invertTree(TreeNode* root) {
if(root == NULL) return root;
invertTree(root->left);
invertTree(root->right);
swap(root->left, root->right);
return root;
}
};