← Questions

Count visible people in a line

0
GoogleCodingLast asked Jul 2026

A coding interview question asked in Google's first round (coding), last asked Jul 2026. It tests monotonic stack and arrays.

People stand in a line, and heights[i] is the height of the person at position i. Two people can see each other when nobody standing between them is taller than both of them.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Google · First round: coding · Last asked Jul 202645 min · Coding in a Google Doc, no syntax highlighting or autocomplete · No AI

What it tests

monotonic stack · arrays

Your code and the AI tutor open when you unlock this question.