Question bank › Monotonic Stack
Dsa Monotonic Stack Warm-up

Next Lesser Element

Given an array of integers, find the index of the next lesser element for each element in the array. If there is no next lesser element, return -1 for that element. Print the results as space-separated indices. Input Format: - A single line containing N followed by N space-separated integers. Output Format: - A single line with space-separated indices of the next lesser elements. Example: Input: 4 4 5 2 10 Output: 2 -1 3 -1

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