Available question text
For each query (a,b) return the leftmost index j > max(a,b) such that heights[j] > heights[a] and heights[j] > heights[b], or -1 if no such building exists. The core challenge is answering many "first element to the right exceeding a given threshold" queries efficiently, typically via next-greater/monotonic-stack preprocessing and jump pointers (binary lifting).
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2940. Find Building Where Alice and Bob Can Meet
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source