Interview Question

Interview

You are given a stock sequence like: 3, 6, 2,10, 5, 9. Each

  number represents the price for buying/selling a certain stock each day. You can buy once and sell only once. Find the maximum possible gain.
Tags:
algorithm
Answer

Interview Answer

1 Answer

1

This follows the dynamic programming concept of maximum subarray sum

KRS8785 on Mar 16, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.