Loading...

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
mid, senior

Problem

A trading analytics tool wants to show how many consecutive days a stock held above previous closing prices. Given a list of daily stock prices, write a function that returns the span for each day - the number of consecutive days (including today) where the price was less than or equal to today's price.

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.