Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 题解: Solution 1 暴 ...
分类:
其他好文 时间:
2018-03-24 14:27:06
阅读次数:
167
1 题目 Given a string, find the length of the longest substring without repeating characters. 给定一个字符串,求该字符串的最长且不含有重复字符的子字符串。 Examples: Given "abcabcbb", ...
分类:
其他好文 时间:
2018-03-23 11:40:09
阅读次数:
160
Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng ...
分类:
其他好文 时间:
2018-03-22 19:14:41
阅读次数:
125
题目中文:求最长回文子串 题目难度:Medium 题目内容: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. 翻译: ...
分类:
编程语言 时间:
2018-03-19 19:09:23
阅读次数:
224
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The length ...
分类:
其他好文 时间:
2018-03-17 21:42:03
阅读次数:
207
题目描述 设G为有n个顶点的有向无环图,G中各顶点的编号为1到n,且当为G中的一条边时有i < j。设w(i,j)为边的长度,请设计算法,计算图G中<1,n>间的最长路径。 输入输出格式 输入格式: 输入文件longest.in的第一行有两个整数n和m,表示有n个顶点和m条边,接下来m行中每行输入3 ...
分类:
其他好文 时间:
2018-03-14 22:39:11
阅读次数:
220
Description: Given a string, find the length of the longest substring without repeating characters. 题意: 输入一个字符串, 输出最长不重复子串的长度 思路: 比较一般的思路是, 只要是有关于重复的应 ...
分类:
其他好文 时间:
2018-03-12 22:54:30
阅读次数:
211
def longestCommonSubstring(self, A, B): # write your code here if A == '' or B == '': return 0 if len(A) >= len(B): L, L1 = A[:], B[:] else: L, L... ...
分类:
其他好文 时间:
2018-03-11 17:41:51
阅读次数:
109
Given a string, find the length of the longest substring T that contains at most k distinct characters. For example, Given s = “eceba” and k = 2, T is ...
分类:
其他好文 时间:
2018-03-10 10:19:58
阅读次数:
246
问题链接 "LeetCode 3" 题目解析 求字符串的 最长无重复子串 。 解题思路 第一个问题是 子串 ,注意是连续的。 建立一个符号哈希数组 $in[256]$,代表该符号时候出现过,256大小是因为ASCII表共能表示256个字符。初始化为0,代表未出现,当 $in[i] 0$ 时,表示该字 ...
分类:
其他好文 时间:
2018-03-09 20:37:22
阅读次数:
279