Arrays

Best Time to Buy and Sell Stock

easy
You are given an array `prices` where `prices[i]` is the price of a stock on day i. You want to maximize profit by choosing a single day to buy and a different day in the future to sell. Return the maximum profit. If no profit is possible, return 0.
Hint steps(0/2 revealed)
  1. 1

    Complete previous step or reveal to unlock this hint.

  2. 2

    Complete previous step or reveal to unlock this hint.