上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页

2019年6月28日

[LeetCode] 108. 将有序数组转换为二叉搜索树

摘要: 题目链接 : https://leetcode cn.com/problems/convert sorted array to binary search tree/ 题目描述: 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两 阅读全文

posted @ 2019-06-28 20:16 威行天下 阅读(162) 评论(0) 推荐(0) 编辑

[LeetCode] 107. 二叉树的层次遍历 II

摘要: 题目链接 : https://leetcode cn.com/problems/binary tree level order traversal ii/ 题目描述: 给定一个二叉树,返回其节点值自底向上的层次遍历。 (即按从叶子节点所在层到根节点所在的层,逐层从左向右遍历) 例如: 给定二叉树 [ 阅读全文

posted @ 2019-06-28 20:15 威行天下 阅读(147) 评论(0) 推荐(0) 编辑

2019年6月27日

[LeetCode] 104. 二叉树的最大深度

摘要: 题目链接 : https://leetcode cn.com/problems/maximum depth of binary tree/ 题目描述: 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示例: 给定二叉 阅读全文

posted @ 2019-06-27 20:42 威行天下 阅读(226) 评论(0) 推荐(0) 编辑

[LeetCode] 106. 从中序与后序遍历序列构造二叉树

摘要: 题目链接 : https://leetcode cn.com/problems/construct binary tree from inorder and postorder traversal/ 题目描述: 根据一棵树的中序遍历与后序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如 阅读全文

posted @ 2019-06-27 20:41 威行天下 阅读(115) 评论(0) 推荐(0) 编辑

[LeetCode] 105. 从前序与中序遍历序列构造二叉树

摘要: 题目链接 : https://leetcode cn.com/problems/construct binary tree from preorder and inorder traversal/ 题目描述: 根据一棵树的前序遍历与中序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如, 阅读全文

posted @ 2019-06-27 20:40 威行天下 阅读(140) 评论(0) 推荐(0) 编辑

2019年6月26日

[LeetCode] 103. 二叉树的锯齿形层次遍历

摘要: 题目链接 : https://leetcode cn.com/problems/binary tree zigzag level order traversal/ 题目描述: 给定一个二叉树,返回其节点值的锯齿形层次遍历。(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行)。 例 阅读全文

posted @ 2019-06-26 19:58 威行天下 阅读(191) 评论(0) 推荐(0) 编辑

[LeetCode] 102. 二叉树的层次遍历

摘要: 题目链接 : https://leetcode cn.com/problems/binary tree level order traversal/ 题目描述: 给定一个二叉树,返回其按层次遍历的节点值。 (即逐层地,从左到右访问所有节点)。 例如: 给定二叉树: [3,9,20,null,null 阅读全文

posted @ 2019-06-26 19:57 威行天下 阅读(149) 评论(0) 推荐(0) 编辑

2019年6月25日

[Leetcode] 100. 相同的树

摘要: 题目链接 : https://leetcode cn.com/problems/same tree/ 题目描述: 给定两个二叉树,编写一个函数来检验它们是否相同。 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 示例: 示例 1: 示例 2: 示例 3: 思路: 直接看代码! 思 阅读全文

posted @ 2019-06-25 20:06 威行天下 阅读(144) 评论(0) 推荐(0) 编辑

[LeetCode] 101. 对称二叉树

摘要: 题目链接 : https://leetcode cn.com/problems/symmetric tree/ 题目描述: 给定一个二叉树,检查它是否是镜像对称的。 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。 但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的: 阅读全文

posted @ 2019-06-25 20:06 威行天下 阅读(127) 评论(0) 推荐(0) 编辑

[LeetCode] 99. 恢复二叉搜索树

摘要: 题目链接 : https://leetcode cn.com/problems/recover binary search tree/ 题目描述: 二叉搜索树中的两个节点被错误地交换。 请在不改变其结构的情况下,恢复这棵树。 示例: 示例 1: 示例 2: 进阶: 使用 O(n) 空间复杂度的解法很 阅读全文

posted @ 2019-06-25 08:31 威行天下 阅读(700) 评论(0) 推荐(0) 编辑

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页

导航