Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
其他好文 时间:
2015-07-18 21:14:22
阅读次数:
120
题目:
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 windo...
分类:
编程语言 时间:
2015-07-18 12:38:58
阅读次数:
196
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-07-18 00:24:41
阅读次数:
147
这个也是简单题目,但是关键在于题意的理解。
题目原文就一句话:Write a function to find the longest common prefix string amongst an array of strings.
题意是给一个字符串数组,找出这个字符串数组中所有字符串的最长公共前缀。
注意是限定的前缀,而不是子串。...
分类:
其他好文 时间:
2015-07-17 22:53:11
阅读次数:
134
比较简单的DP,用记忆化搜索比较简单,递推。。。应该不好写吧 。
很容易发现,对于同一个位置,它的最长路是一定的, 不会变的,因为路是递减的,所以该题很适合用记忆化搜索 。 由此我们也可以发现DP和搜索的联系 。
代码如下:
#include
using namespace std;
int T,r,c,a[105][105],d[105][105];
int dx[] = {0,1,...
分类:
其他好文 时间:
2015-07-17 22:47:06
阅读次数:
122
#ifndef LONG_PATH_H#define LONG_PATH_H#include#include#define MAX 65535int graphPath_longest(int (*Graph)[5],int Length,int origin,int destin ); void ...
分类:
其他好文 时间:
2015-07-17 20:54:10
阅读次数:
212
#ifndef PALINDROME_H_#define PALINDROME_H_#include#includeint palindrome_longest(char *str,int front,int back); #endif #include"Palindrome.h"#define M...
分类:
其他好文 时间:
2015-07-17 20:52:05
阅读次数:
238
030 Substring with Concatenation of All Words用一个dictiionary来记录当前对应还有多少需要match的word。 dict.copy()用来copy dictionary.from collections import defaultdictcl...
分类:
其他好文 时间:
2015-07-17 15:49:29
阅读次数:
97
题目:
Write a function to find the longest common prefix string amongst an array of strings.
就是要求一些字符串的最长公共前缀。
code:
class Solution {
public:
string longestCommonPrefix(vector& strs) {...
分类:
其他好文 时间:
2015-07-17 14:09:38
阅读次数:
116
1.8 Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 i...
分类:
其他好文 时间:
2015-07-17 07:08:39
阅读次数:
104