先上题目:Longest Common SubstringTime Limit: 8000/4000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4010Accepted Submissi...
分类:
其他好文 时间:
2014-08-05 18:43:09
阅读次数:
255
题目原文:
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.
题意解析:
最长回文子串。就是...
分类:
其他好文 时间:
2014-08-05 15:56:59
阅读次数:
290
题目:Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partition....
分类:
编程语言 时间:
2014-08-05 13:32:29
阅读次数:
252
找出单词的最长公共前缀class Solution {public: string longestCommonPrefix(vector &strs) { int len=strs.size(); if(len==0) return ""; ...
分类:
其他好文 时间:
2014-08-05 00:09:58
阅读次数:
192
LCS是两个序列相似性的一种度量方法;若序列s1:2,5,7,9,3,1,2 s2:3,5,3,2,8则LCS为:5,3,2思路可参考:http://www.csie.ntnu.edu.tw/~u91029/LongestCommonSubsequence.html具体代码实现为: 1 #in...
分类:
其他好文 时间:
2014-08-04 13:47:37
阅读次数:
290
这题关键注意:T可能有重复,所以得统计次数,我之前理解错了,后来参考别人代码才知道的。思路就是双指针+字符hash,具体见注释 1 class Solution { 2 public: 3 string minWindow(string S, string T) { 4 ...
题目: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 lo....
分类:
编程语言 时间:
2014-08-04 04:10:26
阅读次数:
374
题目:
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....
分类:
其他好文 时间:
2014-08-03 23:29:46
阅读次数:
283
题目:uva10285 - Longest Run on a Snowboard(记忆化搜索)
题目大意:给出N * N的矩阵,要求找到一条路径,路径上的值是递减的,求这样的路径的最长长度。
解题思路:记忆话搜索。因为要求最长的路径那么就需要将所有的这样的路径找出,但是直接dfs会超时的。对于同一个位置,从这个点出发的最长路径长度是固定的。所以在找的时候就要将这个位置的最长路径...
分类:
其他好文 时间:
2014-08-03 23:29:06
阅读次数:
299
要求:软件上有一张图片,默认是隐藏的。用户在文本框中输入身份证号(131226198105223452),点击按钮,如果年龄大于18岁,则显示图片。知识点:取当前年份,Date Time Now Year所需用到的函数 函数一: string string.Substring(int s...