Maximum Profit Problem

Felicia Amy
Nov 8 · 3 min read

I got this question not long time ago, I believe this is a very common question that people often got during interviews. The question goes something like this:

Photo by Pixabay from Pexels

Given a list of stock price for certain number of days, you can decide when to buy and sell a stock that can give you the most profit. You can only buy 1 stock a day…

Keep the story going. Sign up for an extra free read.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade