题目描述:
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 ...
分类:
其他好文 时间:
2014-11-19 22:18:52
阅读次数:
225
Maximum Product SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given...
分类:
其他好文 时间:
2014-11-19 21:46:14
阅读次数:
152
问题描述:
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,...
分类:
其他好文 时间:
2014-11-19 20:40:18
阅读次数:
125
题意:
a序列有n(2*10^5)个数字 问在a[i]>=a[j]的情况下 a[i]%a[j]的最大值是多少
思路:
感觉是一道挺乱来的题……
我们可以将ans表示为a[i]-k*a[j] 这样我们枚举k只要知道比k*a[j]大但是不到(k+1)*a[j]的值就好了 考虑到a[i]只要10^6大 因此可以用一个last数组记录小于等于i的数组中的数字 因此只要拿出last[(k...
分类:
其他好文 时间:
2014-11-19 20:37:04
阅读次数:
167
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.
Determine i...
分类:
编程语言 时间:
2014-11-19 18:51:35
阅读次数:
226
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-11-19 17:48:30
阅读次数:
115
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.
Determine i...
分类:
其他好文 时间:
2014-11-19 12:35:24
阅读次数:
130
问题描述:
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.
Dete...
分类:
其他好文 时间:
2014-11-19 11:16:51
阅读次数:
145
Dynamic ProgrammingFind the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the ...
分类:
其他好文 时间:
2014-11-19 10:32:17
阅读次数:
175
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
编程语言 时间:
2014-11-19 07:13:48
阅读次数:
206