/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * }; */ class Solution { public: //需要同时遍历两棵树,都用先序遍历,直接合并到t1上,空间复杂度为O(1) TreeNode* mergeTrees(TreeNode* t1, TreeNode* t2) { i...