- 题目链接:226. 翻转二叉树
- 考查知识:二叉树+遍历
- 题意描述:翻转二叉树中所有结点的左右子树
- 具体代码:
- 方法一:递归
- 辅助变量交换左右子树
class Solution { public: TreeNode* invertTree(TreeNode* root) {
- 辅助变量交换左右子树
- 方法一:递归
class Solution {
public:
TreeNode* invertTree(TreeNode* root) {