Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-04-14 14:35:10
阅读次数:
121
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...
分类:
其他好文 时间:
2015-04-13 18:24:42
阅读次数:
112
题目:leetcode
Longest Valid Parentheses
Given a string containing just the characters '(' and ')',
find the length of the longest valid (well-formed) parentheses substring.
For "(()", the l...
分类:
其他好文 时间:
2015-04-13 16:44:58
阅读次数:
99
刚开始一直WA,一直以为是自己往前延展的时候写错了,后来才发现是ST写错了
+-*/的优先级要比位运算优先级高,以后碰上不清楚优先级的运算一定要加括号
#include
#include
#include
#include
using namespace std;
#define N 100010
char s[N];
int r[N],wa[N],wb[N],wv[N],ws[N],sa...
分类:
其他好文 时间:
2015-04-13 10:59:50
阅读次数:
99
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 "BAN...
#read one file line by line for line in $(cat test1.txt); do echo $line ; done; #while read split line by space while read line do for word in $line d...
分类:
系统相关 时间:
2015-04-13 08:15:09
阅读次数:
193
You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati...
分类:
其他好文 时间:
2015-04-12 23:59:09
阅读次数:
368
描述:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest...
分类:
其他好文 时间:
2015-04-12 20:54:09
阅读次数:
137
回文检测,参考http://blog.csdn.net/feliciafay/article/details/16984031使用时间复杂度和空间复杂度相对较低的动态规划法来检测,具体的做法图一 偶数个回文字符情况图二 奇数个回文字符情况核心就是如果一个子串是回文,如果分别向回文左右侧扩展一个字符相...
分类:
其他好文 时间:
2015-04-12 20:52:05
阅读次数:
125
Write a function to find the longest common prefix string amongst an array of strings.Analyse: 找一些序列的最长前缀子序列。 1 class Solution { 2 public: 3 strin...
分类:
其他好文 时间:
2015-04-12 16:09:54
阅读次数:
110