码迷,mamicode.com
首页 >  
搜索关键字:longest consecutive    ( 3017个结果
[LeetCode] 687. Longest Univalue Path
最长同值路径。题意是给一个二叉树,请输出一个最长的同值路径的长度。例子, Example 1: Input: 5 / \ 4 5 / \ \ 1 1 5 Output: 2 Example 2: Input: 1 / \ 4 5 / \ \ 4 4 5 Output: 2 思路是后序遍历,可参考25 ...
分类:其他好文   时间:2020-03-18 09:19:03    阅读次数:57
后缀自动机
记录一下这几天刷的后缀自动机的题目 "Glass Beads UVA 719" 求 $S$ 循环同构的最小表示 将 $S$ copy 成 $SS$ 后建出后缀自动机,按字典序走 $n$ 步即可 代码 "Longest Common Substring SPOJ LCS" 求两个串的最长公共子串 对第 ...
分类:其他好文   时间:2020-03-17 19:45:45    阅读次数:76
最长公共前缀
此博客链接: 最长公共前缀(58min) 题目链接:https://leetcode-cn.com/problems/longest-common-prefix/ 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入: ["flower","fl ...
分类:其他好文   时间:2020-03-15 18:58:29    阅读次数:69
ab接口压力测试工具
ab是Apache超文本传输协议(HTTP)的性能测试工具。其设计意图是描绘当前所安装的Apache的执行性能,主要是显示你安装的Apache每秒可以处理多少个请求。 [root@nginx-server ~]# yum install httpd-tools[root@nginx-server ~ ...
分类:其他好文   时间:2020-03-14 12:46:29    阅读次数:69
LeetCode 300. Longest Increasing Subsequence
300. Longest Increasing Subsequence(最长上升子序列) 链接 https://leetcode cn.com/problems/merge two binary trees 题目 给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例: 输入: [10,9,2 ...
分类:其他好文   时间:2020-03-14 10:48:26    阅读次数:54
刷题128. Longest Consecutive Sequence
一、题目说明 题目128. Longest Consecutive Sequence,给定一列无序的整数,计算最大连续的整数的个数。复杂度要求是O(n),难度是Hard! 二、我的解答 这个题目解答方法包括,brute force、sort、hash。但brute force和sort的复杂度不符合 ...
分类:其他好文   时间:2020-03-12 18:50:11    阅读次数:47
leetcode 3. Longest Substring Without Repeating Characters (java)
class Solution { public int lengthOfLongestSubstring(String s) { int[] dict = new int[256]; Arrays.fill(dict, -1); int maxLen = 0, start = -1; for (in ...
分类:编程语言   时间:2020-03-12 14:37:50    阅读次数:71
leetcode 5. Longest Palindromic Substring (java)
class Solution { public String longestPalindrome(String s) { if (s == null || s.length() < 1) return ""; int start = 0; int end = 0; for (int i = 0; i ...
分类:编程语言   时间:2020-03-12 14:14:41    阅读次数:65
1372. Longest ZigZag Path in a Binary Tree
Given a binary tree root, a ZigZag path for a binary tree is defined as follow: Choose any node in the binary tree and a direction (right or left). If ...
分类:其他好文   时间:2020-03-12 09:26:04    阅读次数:76
leetcode0005 最长回文子串的暴力递归
首先声明的是这种解法非常非常的原始和不优雅,甚至比暴力递推还要臭长。 对于最长回文子串这种经典的老题目,有很多亮眼的解法,比如与逆序串取交集。 但我们解决问题不能总是依靠这种眼前一亮(虽然很少亮那么一下),我们应该有一些通用的思考方法,可以用来解决绝大部分问题。 问题的解决都有递归和递推的两种描述, ...
分类:其他好文   时间:2020-03-11 01:28:31    阅读次数:68
3017条   上一页 1 ... 11 12 13 14 15 ... 302 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!