Interview Question

Software Engineer Intern 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.

Interview Answer

1 Answer


This follows the dynamic programming concept of maximum subarray sum

KRS8785 on Mar 16, 2014

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up