Best Time to Buy and Sell Stock (with buy/sell days)
Given an array prices where prices[i] is the stock price on day i (0-indexed), you may buy once and sell once, buying before selling. Find the best buy day, sell day, and the maximum profit.
**In...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
