码迷,mamicode.com
首页 >  
搜索关键字:maximum subsequence    ( 5146个结果)
HashMap源码分析
/** * The default initial capacity - MUST be a power of two. */ static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum ca...
分类:其他好文   时间:2015-08-17 23:35:28    阅读次数:175
求最长公共子序列
最长公共子序列,英文缩写为LCS(Longest Common Subsequence)。其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列,且是所有符合此条件序列中最长的,则 S 称为已知序列的最长公共子序列。而最长公共子串(要求连续)和最长公共子序列是不同的。 #include "stdafx.h" #include #include using names...
分类:其他好文   时间:2015-08-17 19:34:36    阅读次数:116
[LeetCode] Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2015-08-17 14:00:36    阅读次数:212
UVA 11827 Maximum GCD(读入技巧,stringstream的使用)
好久没来写blog了,不能颓了。这道题的数据范围很小,n#include#include#includeusing namespace std;int num[100], n;string s;int gcd(int a, int b){ return b ? gcd(b, a % b) : ...
分类:其他好文   时间:2015-08-17 13:57:25    阅读次数:179
LeetCode:Maximum Depth of Binary Tree
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 farthest le...
分类:其他好文   时间:2015-08-17 11:37:33    阅读次数:123
leetcode - Longest Palindromic Substring
leetcode -Longest Palindromic SubstringGiven a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000,...
分类:其他好文   时间:2015-08-17 00:58:54    阅读次数:112
Longest Common Subsequence (LCS)
最长公共子序列(LCS)是经典的DP问题,求序列a[1...n], b[1..m]的LCS。状态是DP[i][j],表示a[1..i],b[1..j]的LCS。DP转移方程是DP[i][j]= DP[i-1][j-1]+1, a[i] == b[j] max{ DP[i][j-1], DP[i...
分类:其他好文   时间:2015-08-17 00:39:46    阅读次数:159
[线段树]hdu5316
题意: 给出两种操作,一种是求区间漂亮子序列的和的最大值,另一个就是给指定的点改变值。 题目中最重要的一句话:A beautiful subsequence is a subsequence that all the adjacent pairs of elves in the sequence have a different parity of position....
分类:其他好文   时间:2015-08-16 23:05:59    阅读次数:142
HDU 1159
DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence....
分类:其他好文   时间:2015-08-16 22:41:13    阅读次数:122
uva 11404 dp
UVA 11404 - Palindromic Subsequence 求给定字符串的最长回文子序列,长度一样的输出字典序最小的。 对于 [l, r] 区间的最长回文串,他可能是[l+1, r] 和[l, r-1]两个区间的结果。或者当s[l] == s[r]时,区间[l+1, r-1]的结果再加上以s[l], s[r]为首尾的子序列。 dp[l][r]...
分类:其他好文   时间:2015-08-16 21:23:11    阅读次数:99
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!