EasyArray· 68% acceptance
#360

Best Time to Buy and Sell Stock 40

Easy

Return the maximum profit from one buy and one sell. Variant **#40**.

Example 1

Input: prices = [13,9,12,8,11,14]

Output: 6

Constraints

  • 1 <= prices.length <= 10^5

Acceptance: 68% · Topics: array, dynamic-programming

maxProfit

← All practice problems