Grind 75 · Day 4 · Free cheat sheet
Best Time to Buy and Sell Stock
The whole problem on 2 pages: the one-pass solution, a visual walkthrough, edge cases and the follow-up questions interviewers ask.
Download not starting? Open it in your browser.
What’s inside
- The key insight, drawn on a price chart
- The solution in Python, Java and JavaScript
- A step-by-step dry run
- 4 edge cases, including the max − min trap
- What to say in the interview, in 5 steps
- Follow-ups: the rest of the stock problem family