Google L4 Phone Screen
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-04-12Added By Anonymous
Source:Ā Link
š§ Experience: unknown
ā Outcome: Likely rejected
š° Compensation: unknown
š Location: unknown
š¢ Company: Google
š Education: unknown
š Benefits: unknown
š Offer Date: unknown
Find indices of ranges where a number lies.
ranges = {3 , 9} , {2 , 8} , {5 , 10}
f(3) should return { 0 , 1}
f(9) should return {0 , 2}
Bummed out because I was only able to give O(n*maxRange) approach.
O(n * maxRange) for building the ArrayList[] array during the initialization and doing each query in O(1) time
maxRange being the maximum value of right - left in a range {left , right}
After the interview was able to figure out it would probably be solved by Segment Tree, which I did not study :(
I think I'll be rejected.
ā Outcome: Likely rejected
š° Compensation: unknown
š Location: unknown
š¢ Company: Google
š Education: unknown
š Benefits: unknown
š Offer Date: unknown
Find indices of ranges where a number lies.
ranges = {3 , 9} , {2 , 8} , {5 , 10}
f(3) should return { 0 , 1}
f(9) should return {0 , 2}
Bummed out because I was only able to give O(n*maxRange) approach.
O(n * maxRange) for building the ArrayList[] array during the initialization and doing each query in O(1) time
maxRange being the maximum value of right - left in a range {left , right}
After the interview was able to figure out it would probably be solved by Segment Tree, which I did not study :(
I think I'll be rejected.