Dsa
Monotonic Stack
Medium
Daily Pollution Levels
You are given a list of daily pollution levels. For each day, determine how many days it will take until the pollution level decreases below today's level. If it never decreases, return 0 for that day.
Input Format:
- A single line with N (1 <= N <= 100,000) followed by N integers representing the pollution levels.
Output Format:
- A single line with N integers representing the days until pollution levels drop.
Example:
Input:
6 5 4 3 4 2 1
Output:
0 0 0 1 0 0
Key concepts
monotonic_stackpollutionarrays
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