Dsa
Monotonic Stack
Hard
Stock Price Elevation
You are provided with a list of stock prices. For each day, identify the first future day on which the stock price is higher than the current day. If no such day exists, return -1 for that day. Print the indices of the days corresponding to the higher price.
Example:
Input:
100 80 60 70 60 75 85
Output:
-1 3 3 5 5 -1 -1
Input format:
A single line containing space-separated integers representing stock prices over days.
Output format:
A single line containing space-separated integers corresponding to the first future day with a higher price for each current day.
Key concepts
monotonic_stackstock_prices
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