相比 HDOJ 的 fatmouse‘s speed 这道题只需要输出 最长子序列的长度#includeusing namespace std;#define Size 1000int main(){ int N1; int table[Size+1]; i...
分类:
其他好文 时间:
2015-07-08 22:07:17
阅读次数:
110
Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid par...
分类:
其他好文 时间:
2015-07-08 19:08:38
阅读次数:
115
Js的substring和C#的Substring的作用都是从一个字符串中截取出一个子字符串,但它们的使用方法却有很大的不同,下边我们来比较看看:Js的substring语法: 程序代码String.substring(start, end)说明: 返回一个从start开始到end(不包含end)的...
pig里面有一个TOP功能。我不知道为什么用不了。有时间去看看pig源代码。SET job.name 'top_k';SET job.priority HIGH;--REGISTER piggybank.jar;REGISTER wizad-etl-udf-0.1.jar;--DEFINE Sequ...
分类:
Web程序 时间:
2015-07-08 14:30:14
阅读次数:
137
1、编写一个函数,接收一个字符串,把用户输入的字符串中的第一个字母转换成小写然后返回(命名规范骆驼命名)names.SubString(0,1)s.SubString(1);可算有个顺溜点完成的题目了= =!骆驼命名:Camel-Case除第一个单词之外,其他单词首字母大写。帕斯卡:Pascal 在...
分类:
Web程序 时间:
2015-07-08 14:14:01
阅读次数:
162
Substring with Concatenation of All Words
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concate...
分类:
其他好文 时间:
2015-07-08 12:57:18
阅读次数:
104
想法很直接 复杂度O(mn)class Solution: # @param {string[]} strs # @return {string} def longestCommonPrefix(self, strs): n = len(strs) if...
分类:
其他好文 时间:
2015-07-08 08:14:36
阅读次数:
139
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = “aab”,
Return
[...
分类:
其他好文 时间:
2015-07-07 19:28:43
阅读次数:
116
这道题一开始无从下手,想到找到用hashtable,这样查询没个数是否在List中只需要O(1)时间。以上是第一步, 接下来的想法就比较自然, 将每个数都当成可能的起始点进行测试。待测试的起始点为n,如果n-1在set中,则n必不为起始数字,可以continue优化运行时间代码中使用set来实现ha...
分类:
其他好文 时间:
2015-07-07 10:50:22
阅读次数:
120