Dsa
Monotonic Stack
Easy
Next Lesser Element in Prices
You are given a list of stock prices and need to find the next lesser stock price for each price in the list. If there is no lesser price, output -1 for that price. The input is a single line of space-separated integers representing the stock prices.
Example:
Input:
5 2 3 1 4
Output:
2 -1 1 -1 -1
Key concepts
monotonic_stackarrayfinance
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