🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 99 (from laksa071)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

📄
INDEXABLE
CRAWLED
1 day ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://leetcode.com/problems/number-of-visible-people-in-a-queue/
Last Crawled2026-04-17 10:24:58 (1 day ago)
First Indexed2021-07-25 05:32:35 (4 years ago)
HTTP Status Code200
Meta TitleNumber of Visible People in a Queue - LeetCode
Meta DescriptionCan you solve this real interview question? Number of Visible People in a Queue - There are n people standing in a queue, and they numbered from 0 to n - 1 in left to right order. You are given an array heights of distinct integers where heights[i] represents the height of the ith person. A person can see another person to their right in the queue if everybody in between is shorter than both of them. More formally, the ith person can see the jth person if i < j and min(heights[i], heights[j]) > max(heights[i+1], heights[i+2], ..., heights[j-1]). Return an array answer of length n where answer[i] is the number of people the ith person can see to their right in the queue. Example 1: [https://assets.leetcode.com/uploads/2021/05/29/queue-plane.jpg] Input: heights = [10,6,8,5,11,9] Output: [3,1,2,1,1,0] Explanation: Person 0 can see person 1, 2, and 4. Person 1 can see person 2. Person 2 can see person 3 and 4. Person 3 can see person 4. Person 4 can see person 5. Person 5 can see no one since nobody is to the right of them. Example 2: Input: heights = [5,1,2,3,10] Output: [4,1,1,1,0] Constraints: * n == heights.length * 1 <= n <= 105 * 1 <= heights[i] <= 105 * All the values of heights are unique.
Meta Canonicalnull
Boilerpipe Text
There are n people standing in a queue, and they numbered from 0 to n - 1 in left to right order. You are given an array heights of distinct integers where heights[i] represents the height of the i th person. A person can see another person to their right in the queue if everybody in between is shorter than both of them. More formally, the i th person can see the j th person if i < j and min(heights[i], heights[j]) > max(heights[i+1], heights[i+2], ..., heights[j-1]) . Return an array answer of length n where answer[i] is the number of people the i th person can see to their right in the queue . Example 1: Input: heights = [10,6,8,5,11,9] Output: [3,1,2,1,1,0] Explanation: Person 0 can see person 1, 2, and 4. Person 1 can see person 2. Person 2 can see person 3 and 4. Person 3 can see person 4. Person 4 can see person 5. Person 5 can see no one since nobody is to the right of them. Example 2: Input: heights = [5,1,2,3,10] Output: [4,1,1,1,0] Constraints: n == heights.length 1 <= n <= 10 5 1 <= heights[i] <= 10 5 All the values of heights are unique .
Markdown
![Judging...](https://leetcode.com/_next/static/images/light-judging-9d7b0f1c4035b59af3a7d6ccd8e0ac12.gif)![Pending...](https://leetcode.com/_next/static/images/light-pending-9c28f1f18993ec103b273778b5f6a648.gif) ![Debugging...](https://leetcode.com/_next/static/images/premium-lightning-judging-4387bb93db459811b028131cb5ea75d4.gif) Debugging... Submit 00:00:00 [Register](https://leetcode.com/accounts/signup/?next=%2Fproblems%2Fnumber-of-visible-people-in-a-queue%2Fdescription%2F)or[Log in](https://leetcode.com/accounts/login/?next=%2Fproblems%2Fnumber-of-visible-people-in-a-queue%2Fdescription%2F) [Premium](https://leetcode.com/subscribe/?ref=lp_pl&source=qd) Description Description Editorial Editorial Solutions Solutions Submissions Submissions Code Code Testcase Testcase Test Result Test Result [1944\. Number of Visible People in a Queue](https://leetcode.com/problems/number-of-visible-people-in-a-queue/) Hard Topics ![premium lock icon](https://leetcode.com/_next/static/images/lock-a6627e2c7fa0ce8bc117c109fb4e567d.svg)Companies Hint There are `n` people standing in a queue, and they numbered from `0` to `n - 1` in **left to right** order. You are given an array `heights` of **distinct** integers where `heights[i]` represents the height of the `ith` person. A person can **see** another person to their right in the queue if everybody in between is **shorter** than both of them. More formally, the `ith` person can see the `jth` person if `i < j` and `min(heights[i], heights[j]) > max(heights[i+1], heights[i+2], ..., heights[j-1])`. Return *an array* `answer` *of length* `n` *where* `answer[i]` *is the **number of people** the* `ith` *person can **see** to their right in the queue*. **Example 1:** ![](https://assets.leetcode.com/uploads/2021/05/29/queue-plane.jpg) ``` Input: heights = [10,6,8,5,11,9] Output: [3,1,2,1,1,0] Explanation: Person 0 can see person 1, 2, and 4. Person 1 can see person 2. Person 2 can see person 3 and 4. Person 3 can see person 4. Person 4 can see person 5. Person 5 can see no one since nobody is to the right of them. ``` **Example 2:** ``` Input: heights = [5,1,2,3,10] Output: [4,1,1,1,0] ``` **Constraints:** - `n == heights.length` - `1 <= n <= 105` - `1 <= heights[i] <= 105` - All the values of `heights` are **unique**. Accepted 126,114/173.1K Acceptance Rate 72\.8% *** Topics Senior Staff [Array](https://leetcode.com/tag/array/)[Stack](https://leetcode.com/tag/stack/)[Monotonic Stack](https://leetcode.com/tag/monotonic-stack/)[Biweekly Contest 57](https://leetcode.com/contest/biweekly-contest-57/) *** ![icon](https://leetcode.com/_next/static/images/lock-a6627e2c7fa0ce8bc117c109fb4e567d.svg) Companies *** Hint 1 How to solve this problem in quadratic complexity ? *** Hint 2 For every subarray start at index i, keep finding new maximum values until a value larger than arr\[i\] is found. *** Hint 3 Since the limits are high, you need a linear solution. *** Hint 4 Use a stack to keep the values of the array sorted as you iterate the array from the end to the start. *** Hint 5 Keep popping from the stack the elements in sorted order until a value larger than arr\[i\] is found, these are the ones that person i can see. *** Similar Questions [Buildings With an Ocean View](https://leetcode.com/problems/buildings-with-an-ocean-view/) Medium [Sum of Subarray Ranges](https://leetcode.com/problems/sum-of-subarray-ranges/) Medium [Sum of Total Strength of Wizards](https://leetcode.com/problems/sum-of-total-strength-of-wizards/) Hard [Number of People That Can Be Seen in a Grid](https://leetcode.com/problems/number-of-people-that-can-be-seen-in-a-grid/) Medium [Find Building Where Alice and Bob Can Meet](https://leetcode.com/problems/find-building-where-alice-and-bob-can-meet/) Hard *** Discussion (89) Choose a type Comment 💡 Discussion Rules 1\. Please don't post **any solutions** in this discussion. 2\. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. 3\. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it there. Sort by:Best No comments yet. 1 2 3 4 9 Copyright © 2026 LeetCode. All rights reserved. 2\.2K 89 26 Online 1 Ln 1, Col 1 Case 1 Case 2 heights = \[10,6,8,5,11,9\] 9 1 2 › \[10,6,8,5,11,9\] \[5,1,2,3,10\] Source FindHeaderBarSize FindTabBarSize FindBorderBarSize
Readable Markdown
There are `n` people standing in a queue, and they numbered from `0` to `n - 1` in **left to right** order. You are given an array `heights` of **distinct** integers where `heights[i]` represents the height of the `ith` person. A person can **see** another person to their right in the queue if everybody in between is **shorter** than both of them. More formally, the `ith` person can see the `jth` person if `i < j` and `min(heights[i], heights[j]) > max(heights[i+1], heights[i+2], ..., heights[j-1])`. Return *an array* `answer` *of length* `n` *where* `answer[i]` *is the **number of people** the* `ith` *person can **see** to their right in the queue*. **Example 1:** ![](https://assets.leetcode.com/uploads/2021/05/29/queue-plane.jpg) ``` Input: heights = [10,6,8,5,11,9] Output: [3,1,2,1,1,0] Explanation: Person 0 can see person 1, 2, and 4. Person 1 can see person 2. Person 2 can see person 3 and 4. Person 3 can see person 4. Person 4 can see person 5. Person 5 can see no one since nobody is to the right of them. ``` **Example 2:** ``` Input: heights = [5,1,2,3,10] Output: [4,1,1,1,0] ``` **Constraints:** - `n == heights.length` - `1 <= n <= 105` - `1 <= heights[i] <= 105` - All the values of `heights` are **unique**.
Shard99 (laksa)
Root Hash17128001481954483899
Unparsed URLcom,leetcode!/problems/number-of-visible-people-in-a-queue/ s443