发布时间:2014-10-07 15:30:17
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.我试着用了最简单的匹配,居然过了,以后再用KMP之类的好好研究一下。char *strStr(char *haystack, char *needle) {  .........【阅读全文】
发布时间:2014-10-07 15:26:48
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.H.........【阅读全文】
发布时间:2014-10-07 15:06:53
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,没想到存储没报错,时间报错了,TLE了。原理是记录所有回文,然后更新最大值。比较值得注意.........【阅读全文】
发布时间:2014-10-07 14:55:35
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", which has length = 2..........【阅读全文】
发布时间:2014-10-07 14:38:42
Given 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"..........【阅读全文】