滑动窗口思想: 如对于abcabcab,无重复字符的最长字串为abc,长度为3。使用滑动窗口思想,当窗口为abc时,再进入a,队列变为abca,不满足要求,需要移动窗口。移动的方法为抛弃最左边的字符,即a,持续该操作,直到序列末尾。 注:unordered_set用来判断只去重不重复的需求(set是 ...
分类:
其他好文 时间:
2019-10-05 00:59:01
阅读次数:
87
题目描述 Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The an ...
分类:
其他好文 时间:
2019-10-03 17:47:38
阅读次数:
75
题目链接:https://leetcode.com/problems/longest-continuous-increasing-subsequence/description/ ...
分类:
其他好文 时间:
2019-10-02 16:18:41
阅读次数:
91
DP: Extend palindrome: (better) ...
分类:
其他好文 时间:
2019-09-30 14:41:20
阅读次数:
95
Difficulty: Hard More:【目录】LeetCode Java实现 Description Given a string containing just the characters '(' and ')', find the length of the longest valid ...
分类:
其他好文 时间:
2019-09-28 23:13:49
阅读次数:
116
Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Note: There may be more than one LIS combination, it ...
分类:
其他好文 时间:
2019-09-28 11:16:10
阅读次数:
106
题目: 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。 题解: i j 分别记录目标字符串的左右边界。对当前字符 x,如果前面出现过,则更新左边界为上次出现位置的下一个,然后更新当前字符 x 的位置,遍历过程中记录一下 j - i + 1的最大值就好了。 ...
分类:
其他好文 时间:
2019-09-19 09:15:42
阅读次数:
50
编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入: ["flower","flow","flight"]输出: "fl"示例 2: 输入: ["dog","racecar","car"]输出: ""解释: 输入不存在公共前缀。说明: 所有输入 ...
分类:
编程语言 时间:
2019-09-14 15:51:50
阅读次数:
140
[Leetcode] 32.最长有效括号 关键词:DP,动态规划,动规。 最近在刷DP专栏的题目,这是其中一道题。 给定一个只包含 和 的字符串,找出最长的包含有效括号的子串的长度。 "longest valid parentheses" Sample1 Sample2 对于DP嘛,首先还是需要抽象 ...
分类:
其他好文 时间:
2019-09-13 15:33:51
阅读次数:
97
[徐州网络赛]Longest subsequence 可以分成两个部分,前面相同,然后下一个字符比对应位置上的大。 枚举这个位置 用序列自动机进行s字符串的下标转移 注意最后一个字符 c++ include const int maxn = 1e6 + 7; using namespace std; ...
分类:
其他好文 时间:
2019-09-13 13:48:22
阅读次数:
89