2017年8月31日

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) 编辑

2017年8月29日

leetcode-- 90. Subsets II

摘要: 1、问题描述 Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplic 阅读全文

posted @ 2017-08-29 01:12 Shihu 阅读(287) 评论(0) 推荐(0) 编辑

2017年8月28日

leetcode--401. Binary Watch

摘要: 1、问题描述 A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED repr 阅读全文

posted @ 2017-08-28 00:19 Shihu 阅读(210) 评论(0) 推荐(0) 编辑

2017年8月27日

leetcode-- 79. Word Search

摘要: 1、问题描述 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where 阅读全文

posted @ 2017-08-27 19:21 Shihu 阅读(210) 评论(0) 推荐(0) 编辑

leetcode--51. N-Queens

摘要: 1、问题描述: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, ret 阅读全文

posted @ 2017-08-27 14:21 Shihu 阅读(179) 评论(0) 推荐(0) 编辑

导航