Dsa
Monotonic Stack
Easy
Daily Steps Tracking
You have a record of daily step counts over a week. For each day, find how many days it will take for the step count to be at least the same as the maximum step count seen so far. If there is no future day that meets this condition, return 0 for that day.
Input Format:
- A single line of space-separated integers representing daily step counts.
Output Format:
- A single line of space-separated integers representing the days until reaching or exceeding the max step count.
Example:
Input:
3000 5000 4500 6000 7000 3000
Output:
1 1 1 1 0 0
Key concepts
monotonic_stacktrackingarrays
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now