121. Best Time to Buy and Sell Stock

this one: buy one, sell once, so we focus on max profit!

time: O(n)

space: O(1)

dp

time: O(n)

space: O(n)

Last updated

Was this helpful?