Dsa
Monotonic Stack
Easy
Weather Relative Visibility
You have data on visibility levels in a series of weather reports. For each day, determine how many days you could go back and still have a visibility level greater than or equal to that day’s level. Input consists of a line of space-separated integers representing visibility levels.
Example:
Input:
4 3 5 2 1 0 6
Output:
1 1 3 1 1 1 0
Key concepts
monotonic_stackarrayenvironment
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