Google | L3 | Phone Screen | Feb 2022 | India | Reject
Anonymous User
632

[10, 5, 100,-5]
You are given a set of queries i,j where i, j  denote start and end index of  subarrays of a given array. Find max value of each subarray 
and print in an array.
You are given a set of queries (in an array)
Queries = [(0, 2), (0, 1), (2,3)]
An array with maximum values of for the queries = [100, 10, 100]
He wanted I should do some preprocessing and have an O(1) solution.

I couldn’t understand the solution so he told me to consider if I am not given the queries what I would do. By considering all ranges.

Is there a similar problem on leetcode?
Comments (5)