摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes... 阅读全文
posted @ 2014-11-27 06:46 LiBlog 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.NOTE: the return is the list of all a... 阅读全文
posted @ 2014-11-27 06:12 LiBlog 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Implement pow(x, n).Analysis:x^n = x^(n/2)*x^(n/2) (*x, if n is odd).NOTE: We need consider n0) 8 res = powRecur(x,n); 9 else{10 ... 阅读全文
posted @ 2014-11-27 04:58 LiBlog 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,... 阅读全文
posted @ 2014-11-27 04:37 LiBlog 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, ... 阅读全文
posted @ 2014-11-27 02:03 LiBlog 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity.Analsys:We use Merge Sort.NOTE: We should practice other sort algorithm, linke Q... 阅读全文
posted @ 2014-11-27 01:03 LiBlog 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],t... 阅读全文
posted @ 2014-11-27 00:22 LiBlog 阅读(110) 评论(0) 推荐(0) 编辑