Best Time to Buy and Sell Stock II
Asked in the Technical interview stage. Written in Google Sheets with dry run.
Given an array prices, where prices[i] is the stock price on day i, return the maximum profit obtainable with unlimited transactions. You may hold at most one share at a time, and you must sell before buying again.
prices, a list of integers.def max_profit(prices):