The Market Streak
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
You have a stock's daily closing prices in `prices`, oldest first. For each day, report how many consecutive days up to and including that day had a price no greater than that day's price; the run ends the moment an earlier day was more expensive. Return one count per day in the same order, and every day counts at least itself.
Summary
Some stocks run longer than you think.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.