Loading...
The Market Timer
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- junior, mid
Problem
You are given a list of stock prices where each index represents a day. You may buy on one day and sell on any later day. Determine the maximum profit you can achieve from a single buy-sell transaction. If no profit is possible, return 0.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.