上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 33 下一页
摘要: 地址:https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/ <?php /** 根据一棵树的前序遍历与中序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如, 阅读全文
posted @ 2020-05-24 22:33 花花妹子。 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/validate-binary-search-tree/ <?php /** 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: 节点的左子树只包含小于当前节点的数。 节点的右子树只包含大于当前 阅读全文
posted @ 2020-05-24 22:05 花花妹子。 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/diameter-of-binary-tree/ <?php /** 给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。这条路径可能穿过也可能不穿过根结点。 示例 : 给定二叉树 1 阅读全文
posted @ 2020-05-24 21:23 花花妹子。 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/same-tree/ <?php /** 给定两个二叉树,编写一个函数来检验它们是否相同。 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 示例 1: 输入: 1 1 / \ / \ 2 3 2 3 [1,2 阅读全文
posted @ 2020-05-24 11:23 花花妹子。 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/binode-lcci/ <?php /** 二叉树数据结构TreeNode可用来表示单向链表(其中left置空,right为下一个链表节点)。实现一个方法,把二叉搜索树转换为单向链表,要求值的顺序保持不变,转换操作应是原址的, 阅读全文
posted @ 2020-05-24 10:31 花花妹子。 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/ /** * Definition for a Node. * class Node { * public $val = null; * public $childre 阅读全文
posted @ 2020-05-22 11:14 花花妹子。 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/ /** * Definition for a Node. * class Node { * public $val = null; * public $childr 阅读全文
posted @ 2020-05-22 11:04 花花妹子。 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/increasing-order-search-tree/ /** * Definition for a binary tree node. * class TreeNode { * public $val = null; * 阅读全文
posted @ 2020-05-22 10:52 花花妹子。 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/maximum-depth-of-n-ary-tree/ <?php /** 559. N叉树的最大深度 给定一个 N 叉树,找到其最大深度。 最大深度是指从根节点到最远叶子节点的最长路径上的节点总数。 例如,给定一个 3叉树 阅读全文
posted @ 2020-05-22 10:33 花花妹子。 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 地址:https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/ <?php /** 108. 将有序数组转换为二叉搜索树 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 本题中,一个高度平衡 阅读全文
posted @ 2020-05-22 10:20 花花妹子。 阅读(102) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 33 下一页