题目: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
Write a SQL query to rank scores. If there is a tie between two scores, both should have the same ranking. Note that after a tie, the next ranking number should be the next consecutive integer value. ...
分类:
其他好文 时间:
2015-04-13 09:43:20
阅读次数:
119
描述: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 SQL query to find all numbers that appear at least three times consecutively.
+----+-----+
| Id | Num |
+----+-----+
| 1 | 1 |
| 2 | 1 |
| 3 | 1 |
| 4 | 2 |
| 5 | 1 |
| 6 | 2...
分类:
其他好文 时间:
2015-04-12 16:15:54
阅读次数:
121
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
如果字符串数组只有一个,那么最长前缀就是它本身;如果有多个,我们把第一个设为当前最长前缀,拿当前最长前缀去和第二个比较,再选出最长前缀,一次往后即可!代码:#include#include#includeusing namespace std;string longestCommonPrefix(v...
分类:
其他好文 时间:
2015-04-11 16:09:23
阅读次数:
131
Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest...
分类:
其他好文 时间:
2015-04-11 01:18:51
阅读次数:
113
??
问题描述:Write a function to find the longest common prefix stringamongst an array of
strings.
问题分析:
代码:
public class Solution {
public String longestCommonPrefix(String[] strs) {
...
分类:
其他好文 时间:
2015-04-10 22:11:48
阅读次数:
106
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2015-04-10 19:43:32
阅读次数:
102