Question bank › Monotonic Stack
Dsa Monotonic Stack Easy

Bridge Pier Support

A bridge is supported by a series of piers. For stability, each pier must find its 'Left Support Anchor'. This is the 1-based index of the nearest pier to its left that is shorter than or equal to the current pier's height. If no such pier exists, output 0. Example: Piers: [12, 15, 11, 14, 13] - Pier 1 (12): No pier to left. Output 0. - Pier 2 (15): Pier 1 is 12 (<= 15). Output 1. - Pier 3 (11): No pier to left <= 11. Output 0. - Pier 4 (14): Pier 3 is 11 (<= 14). Output 3. - Pier 5 (13): Pier 3 is 11 (<= 13). Output 3. Result: 0 1 0 3 3

Key concepts

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