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…