上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 51 下一页
2014年2月26日
摘要: Reverse Nodes in k-Group2014.2.26 23:37Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-out nodes in the end should remain as it is.You may not alter the values in the nodes, only nodes itself may be 阅读全文
posted @ 2014-02-26 23:55 zhuli19901106 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Palindrome Partitioning II2014.2.26 22:57Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.For example, givens="aab",Return1since the palindrome partitioning["aa","b"]co 阅读全文
posted @ 2014-02-26 23:22 zhuli19901106 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Palindrome Partitioning2014.2.26 22:36Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, givens="aab",Return [ ["aa","b"], ["a","a","b"] ]Soluti 阅读全文
posted @ 2014-02-26 22:51 zhuli19901106 阅读(293) 评论(0) 推荐(0) 编辑
摘要: Merge Intervals2014.2.26 21:28Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].Solution: The problem didn't guarantee that the set of intervals is sorted, so a sort() has to be performed first. After sorting t 阅读全文
posted @ 2014-02-26 21:43 zhuli19901106 阅读(530) 评论(0) 推荐(0) 编辑
摘要: Minimum Window Substring2014.2.26 21:17Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECODEBANC"T="ABC"Minimum window is"BANC".Note:If there is no such window in S that cover 阅读全文
posted @ 2014-02-26 21:26 zhuli19901106 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Maximal Rectangle2014.2.26 20:27Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.Solution: The worst solution for this problem should be O(n^4), and you will use O(n^2) space to speed it up to O(n^3). But we're discussin 阅读全文
posted @ 2014-02-26 20:51 zhuli19901106 阅读(459) 评论(0) 推荐(0) 编辑
摘要: Max Points on a Line2014.2.26 18:13Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Solution1: A simple solution to this problem is O(n^3). Scan every pair of points and see if others are on the line with them. Simple but not efficient. The second so.. 阅读全文
posted @ 2014-02-26 18:48 zhuli19901106 阅读(401) 评论(0) 推荐(0) 编辑
摘要: Largest Rectangle in Histogram2014.2.26 05:06Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar is 1, given height =[2,1,5,6,2,3].The largest rectan 阅读全文
posted @ 2014-02-26 05:22 zhuli19901106 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Jump Game II2014.2.26 04:35Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to reach the last index in the minimum number of jumps.For example:Given array 阅读全文
posted @ 2014-02-26 04:45 zhuli19901106 阅读(211) 评论(0) 推荐(0) 编辑
摘要: Jump Game2014.2.26 04:21Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are able to reach the last index.For example:A =[2,3,1,1,4], returntrue.A =[3, 阅读全文
posted @ 2014-02-26 04:29 zhuli19901106 阅读(329) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 51 下一页