2017年8月31日

leetcode--98. Validate Binary Search Tree

摘要: 1、问题描述 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contai 阅读全文

posted @ 2017-08-31 23:19 Shihu 阅读(439) 评论(0) 推荐(0) 编辑

leetcode--47. Permutations II

摘要: 1、问题描述 Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following un 阅读全文

posted @ 2017-08-31 22:20 Shihu 阅读(212) 评论(0) 推荐(0) 编辑

leetcode-- 100. Same Tree

摘要: 1、问题描述 Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally iden 阅读全文

posted @ 2017-08-31 09:53 Shihu 阅读(134) 评论(0) 推荐(0) 编辑

leetcode--101. Symmetric Tree

摘要: 1、问题描述 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is 阅读全文

posted @ 2017-08-31 09:53 Shihu 阅读(148) 评论(0) 推荐(0) 编辑

leetcode--110. Balanced Binary Tree

摘要: 1、问题描述 Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which t 阅读全文

posted @ 2017-08-31 09:53 Shihu 阅读(169) 评论(0) 推荐(0) 编辑

leetcode--515. Find Largest Value in Each Tree Row

摘要: 1、问题描述 You need to find the largest value in each row of a binary tree. Example: 2、边界条件:root==null 3、思路:层级遍历,每一层找到最大值,记录 4、代码实现 5、api 阅读全文

posted @ 2017-08-31 09:53 Shihu 阅读(109) 评论(0) 推荐(0) 编辑

leetcoe--47. Permutations II

摘要: 1、问题描述 Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following un 阅读全文

posted @ 2017-08-31 09:52 Shihu 阅读(221) 评论(0) 推荐(0) 编辑

Tree--lecture08

摘要: 1、二叉树 完全二叉树(complete binary tree):除了最下面一层都是满的,最下面一层也是优先排列在左边。这样的话父亲节点和孩子节点就在序号上面有关系: 父亲节点为n,那么子节点的编号为2n和2n+1。这样就可以操作序号来操作完全二叉树。 A1 / \ B2 C3 / \ / \ D 阅读全文

posted @ 2017-08-31 09:52 Shihu 阅读(156) 评论(0) 推荐(0) 编辑

leetcode--257. Binary Tree Paths

摘要: 1、问题描述 Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are: 2、边界条件:root为null; 阅读全文

posted @ 2017-08-31 09:52 Shihu 阅读(170) 评论(0) 推荐(0) 编辑

leetcode--199. Binary Tree Right Side View

摘要: 1、问题描述 Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. 阅读全文

posted @ 2017-08-31 01:51 Shihu 阅读(148) 评论(0) 推荐(0) 编辑

导航