Question bank › Monotonic Stack
Dsa Monotonic Stack Easy

Stock Price Drops

You are tracking the stock prices of a company and need to find out after how many days the stock price drops from the current day's price. If the price does not drop in subsequent days, return 0 for that day. Input: - The first line contains an integer n (1 <= n <= 10000), the number of days. - The second line contains n integers representing the stock prices. Output: - A single line containing n integers, the days until the stock price drops. Example: Input: 6 5 1 3 4 2 5 Output: 1 0 1 1 0 0

Key concepts

monotonic_stackstock_pricesarrays

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.