Question bank › Monotonic Stack
Dsa Monotonic Stack Easy

The Corporate Mentor

In a corporate lineup, each employee has an Influence Level. An employee's 'Mentor' is the nearest person to their left in the lineup who has a strictly higher Influence Level. For each employee, output the 0-indexed position of their Mentor. If an employee has no mentor to their left, output -1. Input Format: A single line of space-separated integers representing Influence Levels. Output Format: A single line of space-separated integers representing Mentor indices. Example: Input: 5 10 8 12 6 Output: -1 -1 1 -1 3

Key concepts

monotonic_stackprevious_greater_element

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.