1.问题描述
Invert a binary tree.For example: to Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. 问题来源于Leetcode https://leetcode.com/problems/invert-binary-tree/ 2.问题…
输入一个二叉树,输出其镜像。 如下图,即交换所有节点的左右子树。 这里提供两种思路:使用递归和不使用递归。 使用的二叉树定义如下: public class TreeNode {int val 0;TreeNode left null;TreeNode right null;public TreeN…