06 2014 档案

摘要:Maximum Depth of Binary TreeGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root ... 阅读全文
posted @ 2014-06-26 23:34 陆草纯 阅读(294) 评论(0) 推荐(0) 编辑
摘要:Word Break IIGiven a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Retur... 阅读全文
posted @ 2014-06-26 22:35 陆草纯 阅读(2283) 评论(0) 推荐(0) 编辑
摘要:Simplify PathGiven an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to sh... 阅读全文
posted @ 2014-06-11 20:57 陆草纯 阅读(1491) 评论(0) 推荐(0) 编辑
摘要:Restore IP AddressesGiven a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"255255... 阅读全文
posted @ 2014-06-10 19:38 陆草纯 阅读(3638) 评论(4) 推荐(0) 编辑
摘要:Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runti... 阅读全文
posted @ 2014-06-07 12:30 陆草纯 阅读(372) 评论(0) 推荐(0) 编辑
摘要:Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [... 阅读全文
posted @ 2014-06-05 23:40 陆草纯 阅读(446) 评论(0) 推荐(0) 编辑
摘要:Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres... 阅读全文
posted @ 2014-06-05 16:59 陆草纯 阅读(244) 评论(0) 推荐(0) 编辑
摘要:Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ... 阅读全文
posted @ 2014-06-02 13:09 陆草纯 阅读(2765) 评论(0) 推荐(0) 编辑
摘要:Sort ListSort a linked list inO(nlogn) time using constant space complexity.要求时间复杂度为O(nlogn),那么不能用quickSort了(最坏O(n^2)),所以使用mergeSort.通常写排序算法都是基于数组的,这题... 阅读全文
posted @ 2014-06-01 20:31 陆草纯 阅读(4541) 评论(1) 推荐(0) 编辑
摘要:Merge Sorted ArrayGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note: You may assume that A has enough space (size that ... 阅读全文
posted @ 2014-06-01 00:01 陆草纯 阅读(236) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示