码迷,mamicode.com
首页 >  
搜索关键字:longest ordered subs    ( 3212个结果
【LeetCode】5. Longest Palindromic Substring 最大回文子串
题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo ...
分类:其他好文   时间:2016-10-24 21:03:27    阅读次数:208
LeetCode 104 Maximum Depth of Binary Tree
Problem: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the f ...
分类:其他好文   时间:2016-10-23 07:37:00    阅读次数:187
NOJ 1072 The longest same color grid(尺取)
Problem 1072: The longest same color grid Problem 1072: The longest same color grid Time Limits: 1000 MS Memory Limits: 65536 KB 64-bit interger IO fo ...
分类:其他好文   时间:2016-10-23 02:56:53    阅读次数:312
统计代码git提交的行数
统计某人的代码提交量,包括增加,删除:git log --author="$(git config --get user.name)" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } EN ...
分类:其他好文   时间:2016-10-22 11:56:19    阅读次数:239
最长公共子序列及其引申问题
最长公共子序列是经典的动态规划问题,在很多书籍和文章中都有介绍,这里对这一经典算法进行回顾并对两个follow up questions进行总结和分析。 1. 回顾LCS(longest common subsequence)解法,求LCS长度 典型的双序列动态规划问题,dp[i][j]表示第一个序 ...
分类:其他好文   时间:2016-10-21 00:28:03    阅读次数:266
【leedcode】 Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/ 求最大回文的长度,其实这道题比上一道有意思。 方法1 循环查询 (该方案为O(N*N*N)) 方法2 动态规划 (该方案为O(N*N)) 由于没学过动态规划,特意去学习了一下 方 ...
分类:其他好文   时间:2016-10-20 22:02:08    阅读次数:246
【USACO 2.3】The Longest Prefix
题意: 给你一个少于200000的字符串,求最长的可以划分为给定词典里的单词的前缀。 题解: dp[i]表示第i位结尾的前缀是否可行,然后枚举每一位如果dp[i-1]==1,枚举所有单词,匹配成功的单词,则dp[i+单词长度-1]=1。 注意读入单词是以'.'作为结束,而读入字符串,有可能是很多行, ...
分类:其他好文   时间:2016-10-20 14:54:32    阅读次数:167
动态规划-最长公共子序列
有关概念: 最长公共子序列(LCS,Longest Common Subsequence),两个或者两个以上的所有共同子序列最长的一个(好像和没解释没什么区别) 思路: 对于两个序列a,b f[i][j]表示a序列中1..i的部分和b序列中1...j的部分的LCS 那么易得,对于f[i][j]: ( ...
分类:其他好文   时间:2016-10-20 07:26:20    阅读次数:133
string类问题之滑动窗口类型
Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. Examples: Given  ...
分类:其他好文   时间:2016-10-19 03:02:58    阅读次数:171
动态规划-最长非降子序列
有关概念: 最长上升子序列(LIS,Longest Increasing Subsequence),在一个序列中最长的单调递增的子序列 思路: 求LIS通常有O(n2)和O(nlogn)两种算法 (1)O(n2)算法 fi表示以第i个数结尾的LIS长度 对于序列中的一个数i,在i前面枚举数j,j满足 ...
分类:其他好文   时间:2016-10-18 01:49:15    阅读次数:118
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!