Best Time to Buy and Sell Stock

Easy
#dynamic-programming #arrays

Input: `prices` (list of ints). Return: Max profit (0 if none).

Example

Input: 7, 1, 5, 3, 6, 4
Output: 5
Need a hint?
  • Track min_price and max_profit
Run your code to see output