CodeOath
← All problems

Best Time to Buy and Sell Stock

Easy
arraysdynamic-programming

Return the max profit from buying once and selling later, or 0 if none is possible.

Example:

Input: prices = [7,1,5,3,6,4]
Output: 5