Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-02-05 00:41:45
阅读次数:
200
题目链接: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 paren...
分类:
其他好文 时间:
2015-02-04 23:22:51
阅读次数:
189
题意:
多组数据、
给你一颗树,
然后求一条最长异或路径,
异或路径长度定义为两点间简单路径上所有边权的异或和。
题解:
首先无根树转有根树再在树上跑一遍算出每个点到根的异或和。
然后两点间异或路径长度就是a[i]*a[j]。
因为lca之前那一段都被异或了两次搞没了。
然后求个线性基,然后随便搞搞就可以?可以WA了!
因为那么算哪是简单路径啊,或者说,那特喵的...
分类:
其他好文 时间:
2015-02-04 16:40:01
阅读次数:
228
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-02-03 21:02:01
阅读次数:
155
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-02-03 16:46:32
阅读次数:
112
#title#Longest Substring Without Repeating Characters #description:#Given a string, #find the length of the longest substring without #repeating chara...
分类:
其他好文 时间:
2015-02-03 13:09:35
阅读次数:
136
Q:Write a function to find the longest common prefix string amongst an array of strings.
这道题是要求一组字符串的最长相同前缀。思路很简单,一个一个扫描。
两种特殊情况如下:
1.若strs为空,则返回空字符串
2.若strs只含有一个字符串,则返回该字符串
下面为一般情况:依次取strs[0]的前1...
分类:
其他好文 时间:
2015-02-03 11:05:41
阅读次数:
167
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 ...
分类:
其他好文 时间:
2015-02-03 07:03:24
阅读次数:
139
Longest Ordered Subsequence
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 35502
Accepted: 15572
Description
A numeric sequence of ai is ordered if a1...
分类:
其他好文 时间:
2015-02-02 23:14:01
阅读次数:
274
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-02-02 14:03:33
阅读次数:
101