摘要:
701. 二叉搜索树中的插入操作 //递归遍历搜索树 class Solution { public TreeNode insertIntoBST(TreeNode root, int val) { if (root == null) return new TreeNode(val); if (va 阅读全文
摘要:
105. 从前序与中序遍历序列构造二叉树 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} 阅读全文
摘要:
559. N 叉树的最大深度 //递归 dfs class Solution { public int maxDepth(Node root) { if (root == null) return 0; int depth = 1; for (Node child : root.children) 阅读全文