1. Given a list of
stock_prices in ascending order by
datetime, and their respective dates in list
dts, write a function
max_profit that outputs the max profit by buying and selling at a specific interval.
stock_prices = [10,5,20,32,25,12] dts = [ '2019-01-01', '2019-01-02', '2019-01-03', '2019-01-04', '2019-01-05', '2019-01-06', ] def max_profit(stock_prices,dts) -> 27
2. Now, to make it harder, given the list of stock prices and date times in ascending order by datetime, write
max_profit to output the profit and start and end dates to buy and sell for max profit.
Next question: Comment Upvotes
def max_profit(stock_prices, dts) -> (27, '2019-01-02', '2019-01-04')