for a particular stock for each day in a given year. Your goal is to buy 1 share and later sell it at maximum profit. Formulate a function that takes list P and returns the best day to buy (B) and the best day to sell (S). You have to buy the share before you can later sell it.
Sample input
» P = [30, 20, 10, 15, 17, 25, 20, 23]
Sample output
» B = 3 // buy at price 10
» S = 6 // sell at price 25
Can someone help me solve this please ?
This 👆
you smart you gave us interesting problem to solve for you
it's funny you ended up solving it yourself
Обсуждают сегодня