最多有K个不同字符的最长子串。题意就不解释了,参见159题。例子, Example 1: Input: s = "eceba", k = 2 Output: 3 Explanation: T is "ece" which its length is 3. Example 2: Input: s = ...
分类:
其他好文 时间:
2020-02-28 15:37:15
阅读次数:
51
最多有两个不同字符的最长子串。题意是给一个字符串,请返回一个最长子串的长度。子串的要求是最多只有两个不同的字母。例子, Example 1: Input: "eceba" Output: 3 Explanation: tis "ece" which its length is 3. Example ...
分类:
其他好文 时间:
2020-02-28 13:52:03
阅读次数:
68
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example... ...
分类:
其他好文 时间:
2020-02-27 11:41:45
阅读次数:
73
代码: #include<iostream> #include<stdio.h> using namespace std; const int maxn = 1001; int a[maxn],dp[maxn]; int main(){ int n; cin>>n; for(int i=1;i<=n ...
分类:
其他好文 时间:
2020-02-26 18:32:51
阅读次数:
54
D. Shortest and Longest LIS "原题" Problem Restatement 给出一个序列相邻的大小关系,构造相应长度满足大小关系的 排列 ,使得最长上升子序列最短或最长。 Solution 考虑到给出的是相邻的递增递减,我们会发现序列是由一段上坡一段下坡类似组合而成。而 ...
分类:
其他好文 时间:
2020-02-25 12:44:37
阅读次数:
65
B. Longest Palindrome "原题" Problem Restatement 给出n个,长度为m的字符串。$(1≤??≤100,1≤m≤50) $ 用部分或全部字符串,在一定的顺序拼接下,拼出最长的回文串。 Solution 数据小,暴力贪心即可。 对于每个串寻找是否存在其共轭串(即 ...
分类:
其他好文 时间:
2020-02-25 09:52:21
阅读次数:
57
题目: Given a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the ...
分类:
编程语言 时间:
2020-02-23 19:56:52
阅读次数:
92
无重复字符的最长子串 题目链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: "abcabcbb" ...
分类:
其他好文 时间:
2020-02-23 09:52:15
阅读次数:
59
Given a string, find the longest substring without any repeating characters and return the length of it. The input string is guaranteed to be not null ...
分类:
其他好文 时间:
2020-02-20 22:14:59
阅读次数:
62