题目:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
De...
分类:
其他好文 时间:
2015-04-07 19:42:29
阅读次数:
108
Say you have an array for which the ith element is the price of a given stock on day
i.
Design an algorithm to find the maximum profit. You may complete at most
k transactions.
Note:
You may not ...
分类:
其他好文 时间:
2015-04-07 10:03:35
阅读次数:
154
poj 1458 Common Subsequence http://poj.org/problem?id=1458问题分析:这个题是求两个序列的最长公共最序列长度,在这里要弄清楚两个问题1:本题中所有的子序列并没有要求是连续子序列,所以在求2:哪部分子序列才是最长的 对于给定的X =...
分类:
其他好文 时间:
2015-04-07 00:40:57
阅读次数:
107
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-04-06 15:29:04
阅读次数:
223
题目:
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on...
分类:
其他好文 时间:
2015-04-05 23:34:42
阅读次数:
180
1 #include 2 #include 3 #include 4 #include 5 #include 6 #define sc(x) scanf("%d", &x) 7 #define sc2(x,y) scanf("%d%d", &x, &y) 8 #define pf...
分类:
其他好文 时间:
2015-04-05 23:28:19
阅读次数:
165
题目链接:https://leetcode.com/problems/maximum-product-subarray/较麻烦的解法:先判断数组中有没有0,有的话可以转换为求"0之前"和"0之后"两部分的较大值。遍历,记录数组中负数的个数:偶数:由于数组中都是整数,最大值即这些值的乘积。奇数:有以下...
分类:
其他好文 时间:
2015-04-05 23:22:57
阅读次数:
164
题目链接:https://leetcode.com/problems/binary-tree-maximum-path-sum/题中要求 maxPathSum(TreeNode *root)函数返回二叉树中最大的"Path Sum"。而这个最大的"Path Sum"可以被分解为三部分之和:"左子树的...
分类:
其他好文 时间:
2015-04-05 23:11:44
阅读次数:
158
题目地址:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1553
给定n的数的序列,求最长连续区间满足区间内的数最大值与最小值的差
(尺取法)
const int maxn=10010;
int num[maxn];
int n,k;
int MIN,MAX;
int main()
{
while(scanf("%d%d",&n,&...
分类:
其他好文 时间:
2015-04-05 20:30:41
阅读次数:
259
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-04-05 17:26:22
阅读次数:
131