Question bank › Monotonic Stack
Dsa Monotonic Stack Easy

Next Rising Stock

You have a list of stock prices recorded every minute for a trading day. For each price, find out how many minutes must elapse before the stock price rises. If it never rises again, return 0 for that price. Input Format: - A single line containing space-separated integers representing stock prices. Output Format: - A single line of space-separated integers where each integer is the waiting time in minutes for the next rise or 0 if the price never rises. Example: Input: 100 95 100 98 99 101 99 Output: 0 1 0 1 1 0 0

Key concepts

monotonic_stackfinance

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.