题目:Write a function to find the longest common prefix string amongst an array of strings.
翻译:求一个字符串数组中 共同的最长前缀。
思路:以第一个串为基准,逐个位置遍历,并遍历字符串数组,如果出现某个字符串长度小于当前位置,或者出现当前位置的字符不相同,返回字串strs[0].substring(0,p...
分类:
其他好文 时间:
2015-04-23 11:05:31
阅读次数:
108
Sum of Consecutive Prime NumbersTime Limit:1000MSMemory Limit:65536KTotal Submissions:20560Accepted:11243DescriptionSome positive integers can be repr...
分类:
其他好文 时间:
2015-04-22 23:50:54
阅读次数:
130
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-22 07:04:07
阅读次数:
126
题目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-21 18:05:04
阅读次数:
182
find the longest of the shortestTime Limit: 1000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2094Accepted Submi...
分类:
编程语言 时间:
2015-04-21 17:50:44
阅读次数:
177
problem:
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Hide Tags
Tr...
分类:
其他好文 时间:
2015-04-21 11:20:10
阅读次数:
108
题意:输出最长递增子序列的长度思路:直接裸LIS,
#include
const int N = 1001;
int a[N], f[N], d[N]; // d[i]用于记录a[0...i]的最大长度
int bsearch(const int *f, int size, const int &a) {
int l=0, r=size-1;
while( l <= r ){...
分类:
其他好文 时间:
2015-04-20 17:03:26
阅读次数:
156
经典问题,可以把周边都做了,详见ref http://blog.csdn.net/linhuanmars/article/details/19949159public class Solution { public int lengthOfLongestSubstring(String s) ...
分类:
其他好文 时间:
2015-04-20 13:07:35
阅读次数:
115
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-04-19 15:49:13
阅读次数:
98
总结帖http://blog.csdn.net/linhuanmars/article/details/39366817code 参考帖http://www.cnblogs.com/springfor/p/3869981.htmlhttp://blog.csdn.net/linhuanmars/ar...
分类:
其他好文 时间:
2015-04-19 12:54:10
阅读次数:
120