Question bank › Monotonic Stack
Dsa Monotonic Stack Easy

Height Visibility in Skyline

You have heights of buildings in a city skyline represented as a list of integers. For each building, determine how many buildings can be seen in a straight line to the left that do not block the view. Output the count for each building. The input is a single line of space-separated integers representing building heights. Example: Input: 3 1 4 1 2 Output: 1 0 2 1 1

Key concepts

monotonic_stackgeometryarray

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.