NeetCode #377LC-1944HardStack
← Back to All Problems

#377 · #1944 · Number of Visible People in a Queue(队列中可以看到的人数)

📌 Problem Statement & Constraints

There are n people in a queue, heights[i] is the height of the i-th person. A person can see the next person to the right who is taller, and everyone shorter in between. Return an array where answer[i] is the number of people person i can see to their right. Constraints: 1 <= n <= 10^5, 1 <= heights[i] <= 10^5.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!