Given a static array nums, return the maximum value for each queried interval. Since the data never changes, preprocessing can answer many range maximum queries efficiently, making this a standard advanced tree-style range query problem.
nums = static integer array, queries = range maximum requests
maximum for each query, in order
Example 1:
Input:
nums = [2,5,1,4,9,3] queries = [[0,3],[1,4]]
Output:
[5,9]
Explanation:
The maximum in the first interval is 5, and the maximum in the second interval is 9.
Example 2:
Input:
nums = [1,7,3] queries = [[0,2]]
Output:
[7]
Explanation:
The largest value in the array is 7.