← Questions

Count visible people in a line

0
GoogleCodingLast asked Jul 2026

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.

First return how many people the last person in the line can see. Then return that count for every position.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding