DIY: Best Time to Buy and Sell Stock

We'll cover the following

Problem statement

You have an array for which the ith element is the price of a given stock on day i.

If you are only permitted to complete one transaction at most (e.g, buy one and sell one share of the stock), design an algorithm to find the maximum profit.

Note: You cannot sell a stock before you buy one. ...

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Devpath's Terms of Service and Privacy Policy