Easy · Sliding window
Best Time to Buy and Sell Stock
Each number is a day’s price. Buy on one day and sell on a later one for the largest profit. Return 0 if there is none.
prices = [7, 1, 5, 3, 6, 4] → 5Record your take
Easy · Sliding window
Each number is a day’s price. Buy on one day and sell on a later one for the largest profit. Return 0 if there is none.
prices = [7, 1, 5, 3, 6, 4] → 5Record your take