Created
January 3, 2018 08:11
-
-
Save jianminchen/bf12daa3429653e757f9f47416f9bd04 to your computer and use it in GitHub Desktop.
Leetcode 617 - recursive - analysis -
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) { | |
if (t1 == NULL) return t2; | |
if (t2 == NULL) return t1; | |
t1->val += t2->val; | |
t1->left = mergeTrees(t1->left, t2->left); | |
t1->right = mergeTrees(t1->right, t2->right); | |
return t1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment