Back to Question

Best Time to Buy and Sell Stock (I)

Question Explain

You are given an array of prices where `prices[i]` is the price of a given stock on the $i$-th day. Find the maximum profit you can achieve. Solve in $O(n)$.

Start Trying This Question Simulation

Click "Start Speaking" and answer the question naturally.