码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
leetcode-32
暴力法 public class Solution { public boolean isValid(String s) { Stack<Character> stack = new Stack<Character>(); for (int i = 0; i < s.length(); i++) { ...
分类:其他好文   时间:2020-01-14 23:55:09    阅读次数:146
[LeetCode] 3. Longest Substring Without Repeating Characters
最长无重复字符的子串。 题意是给一个input字符串,请输出其最长的,没有重复字符的substring。这是two pointer/sliding window的基础题。例子 Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer ...
分类:其他好文   时间:2020-01-14 09:18:01    阅读次数:72
最长回文子串(python)
又开始刷题了,去年被这道题虐过,今天终于写了一个还能看的版本。 这个版本肯定不是最优,这篇博客主要记录一下解题的过程,反思如何构思代码。 最长回文子串 来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/longest palindromic su ...
分类:编程语言   时间:2020-01-10 20:38:00    阅读次数:169
[LeetCode] 3. Longest Substring Without Repeating Characters 最长无重复字符的子串
1.暴力法: 本题让求给定字符串的最长的无重复字符的子串,首先想到暴力解法,穷举出字符串的所有子串,并判断每个子串是否是不重复子串,具体使用hashset或set判是否有重复字符;暴力法效率很差,时间O(n^3),空间O(n);参考代码如下: 1 class Solution { 2 public: ...
分类:其他好文   时间:2020-01-07 13:27:01    阅读次数:84
LeetCode 395. Longest Substring with At Least K Repeating Characters
原题链接在这里:https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/ 题目: Find the length of the longest substring T of a give ...
分类:其他好文   时间:2020-01-06 15:00:54    阅读次数:81
[python] 像gdb一样用pdb debug python程序
如题,我们希望像gdb C程序一样。对python程序就行debug 可以使用pdb来实现这样的功能。 见:https://docs.python.org/3/library/pdb.html 最简单的方法,我们以 longest_substring.py 为例。 使用如下方式执行它,便进入了deb ...
分类:数据库   时间:2020-01-06 12:30:20    阅读次数:100
1143. Longest Common Subsequence
link to problem Description: Given two strings text1 and text2, return the length of their longest common subsequence. A subsequence of a string is a ...
分类:其他好文   时间:2020-01-06 09:54:55    阅读次数:84
687. Longest Univalue Path
/** * 687. Longest Univalue Path(最长的相同值路经) * https://leetcode.com/problems/longest-univalue-path/description/ * https://www.youtube.com/watch?v=yX1hVh ...
分类:其他好文   时间:2020-01-06 09:45:35    阅读次数:79
POJ3764 The xor-longest Path
题目大意:给定一棵树,每条边都有对应的权值,在树上找一条简单的路径,使得所有边权值的异或值最大。 分析:这个类似于前边写过的一个数组选定两个数的最大异或值,先dfs预处理一下从1到i的异或值D[i],然后当你想要取到s到e的异或值就是D[s]^D[e]。接下来就相当于之前写过的两个数的最大异或值问题 ...
分类:其他好文   时间:2020-01-05 18:45:16    阅读次数:56
[LC] 298. Binary Tree Longest Consecutive Sequence
Given a binary tree, find the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starting node to any ...
分类:其他好文   时间:2020-01-05 11:56:36    阅读次数:74
3212条   上一页 1 ... 20 21 22 23 24 ... 322 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!