Dsa
Monotonic Stack
Warm-up
Pressure Drop Days
Given an array of pressure readings over consecutive days, determine how many days it will take until a pressure drop is observed for each day. If a pressure drop isn't observed in the future, use 0. Print the results as a space-separated string.
Input Format:
- A single line containing N followed by N space-separated integers representing pressure readings.
Output Format:
- A single line with space-separated integers indicating the wait days for pressure drops.
Example:
Input:
6 101 103 102 99 100 95
Output:
1 1 1 0 1 0
Key concepts
monotonic_stackarray
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