发布时间:2015-03-31 13:06:39
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 longest palindromic substring.注意:写的过程中问题不少 :穷举是跑不过的。要使用dp ,另外在循环中调用函数效率太低,我们要先把参数保留,.........【阅读全文】
发布时间:2015-03-29 12:04:55
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).1.注意:M+N是偶数时要求平均值。2.并且用起始位置和个数来表示数组。3.求第K个值,我们不断在两个数组平分k来进行计算,去掉小的那个数组。4.........【阅读全文】
发布时间:2015-03-28 11:53:11
//Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.注意:使用数组保存前面的没有出现的字.........【阅读全文】
发布时间:2015-03-27 20:35:48
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)Output: 7 -> 0 -> 8 public Lis.........【阅读全文】
发布时间:2015-03-27 10:57:33
//Given an array of integers, find two numbers such that they add up to a specific target number.////The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and inde.........【阅读全文】