Problem 730. How many trades represent all the profit?
Given a list of results from trades made:
[1 3 -4 2 -1 2 3]
We can add them up to see this series of trades made a profit of 6.
Since the two biggest trades sum to that, we can say that all the profit came from two trades.
What is the minimum number of trades that represent the total profit (possibly exceeding it). All trade lists will represent profitable series.
Solution Stats
Problem Comments
-
2 Comments
Peter Gal-Benedek
on 19 Nov 2012
:)
Robert Weinberg
on 29 Mar 2013
Good problem... but they definitely need to fix the way "size" is calculated.
Solution Comments
Show commentsProblem Recent Solvers603
Suggested Problems
-
5966 Solvers
-
7349 Solvers
-
Maximum running product for a string of numbers
2197 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
611 Solvers
-
688 Solvers
More from this Author51
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!