上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 26 下一页
摘要: Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文
posted @ 2014-07-17 20:19 SunshineAtNoon 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 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 the depth... 阅读全文
posted @ 2014-07-17 19:26 SunshineAtNoon 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret... 阅读全文
posted @ 2014-07-17 17:57 SunshineAtNoon 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2014-07-17 16:57 SunshineAtNoon 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2014-07-17 16:49 SunshineAtNoon 阅读(845) 评论(1) 推荐(0) 编辑
摘要: Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
posted @ 2014-07-17 15:24 SunshineAtNoon 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2014-07-17 14:07 SunshineAtNoon 阅读(256) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa... 阅读全文
posted @ 2014-07-17 11:58 SunshineAtNoon 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文
posted @ 2014-07-17 11:25 SunshineAtNoon 阅读(157) 评论(0) 推荐(0) 编辑
摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs... 阅读全文
posted @ 2014-07-17 10:35 SunshineAtNoon 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 26 下一页