You are given a heights representing the heights of buildings.
You are also given a queries, where queries[i] = [a_i, b_i]. In the a_i and Bob is located at building b_i.
A person at building i can move to building j if and only if i < j and heights[i] < heights[j].
For each query, determine the index of the leftmost building where Alice and Bob can both meet. A person can either stay at their starting building or move to a building with a greater index and strictly greater height.
Return an array ans where ans[i] is the index of the leftmost building where Alice and Bob can meet for the
Constraints:
heights.length
heights[i]
queries.length
queries[i]
heights.length
You are given a heights representing the heights of buildings.
You are also given a queries, where queries[i] = [a_i, b_i]. In the a_i and Bob is located at building b_i.
A person at building i can move to building j if and only if i < j and heights[i] < heights[j].
For each query, determine the index of the leftmost building where Alice and Bob can both meet. A person can either stay at their starting building or move to a building with a greater index and strictly greater height.
Return an array ans where ans[i] is the index of the leftmost building where Alice and Bob can meet for the
Constraints:
heights.length
heights[i]
queries.length
queries[i]
heights.length