string CommonPrefix(string str1,string str2){ int len_1=str1.length(); int len_2=str2.length(); int min_len=len_1>len_2 ? len_2:len_1; str...
分类:
其他好文 时间:
2015-06-01 13:09:54
阅读次数:
92
Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4...
分类:
编程语言 时间:
2015-05-31 18:11:52
阅读次数:
128
Longest Common Prefix
题目:
Write a function to find the longest common prefix string amongst an array of strings. 题意:
找出所有字符串的最长的公共前缀 思路:先找到最短的一个字符串,然后它的长度当作范围,接着判断所有字符串的同一个下标的字符,若全部相等则添加到返回字符...
分类:
其他好文 时间:
2015-05-31 14:06:39
阅读次数:
148
The following iterative sequence is defined for the set of positive integers:
n → n/2 (n is
even)
n → 3n + 1 (n is
odd)
Using the rule above and starting with 13, we generate the following sequ...
分类:
其他好文 时间:
2015-05-31 09:27:37
阅读次数:
117
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 longes...
分类:
编程语言 时间:
2015-05-30 22:24:35
阅读次数:
172
WallTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 31419Accepted: 10619DescriptionOnce upon a time there was a greedy King who ordered his c...
分类:
其他好文 时间:
2015-05-30 19:38:28
阅读次数:
145
题目:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters...
分类:
其他好文 时间:
2015-05-30 16:35:41
阅读次数:
96
LeetCode -- Longest Substring Without Repeating Characters...
分类:
其他好文 时间:
2015-05-29 18:05:31
阅读次数:
124
public class Solution { public int longestConsecutive(int[] nums) { HashMap hs = new HashMap(); for (int i : nums) { hs.pu...
分类:
其他好文 时间:
2015-05-29 11:29:33
阅读次数:
109
public class Solution { public String longestCommonPrefix(String[] strs) { //http://www.cnblogs.com/springfor/p/3872316.html if(strs=...
分类:
其他好文 时间:
2015-05-29 09:47:20
阅读次数:
83