Amazon Interview Question - Frontend SDE-2 - Online assessment
Anonymous User
1667

Given an array for e.g [7,4,5,2,6,5] , in which each element represents the count of boxes stacked in each stack, write a function which returns the the start and end indices of the longest subarray with increasing values so that ** you can pick the maximum number of boxes**. But there is catch here, the first element of the resulting subarray can be a part of the count.
For.e g

input : [7,4,5,2,6,5]
output: [3,4,5]

here 3 is got from 7 as we will select lesser number than 4 this can be done from wherever your longest subarray starts, you can pick the first element ** (only the first element)** in your result subarray.

Comments (3)