Amazon | Phone | Queue Reconstruction by Height
Anonymous User
1740

There is a scenario persons are standing on the line. and each person having property values like persona height and count of tall persons who are standing infront of this person in a line. So now we diburse the list of persons, and when refill the line the persons we should fill in the same order.

Input: {{1,4},{7,0},{2,1},{5,0},{3,2}, {6,0}}

output: {{5,0},{2,1},{6,0}{3,2},{1,4},{7,0} }

Explanation: if we take person heigh 5, front height persons count is 0, because no one in the front. And if we take person height 2 and its front height persons are 1 because 5 height is more than 2. And if we take person height 6, front persons count is 0 because no height persons in the front (5 and 2 are less than 6). etc.... Like that we need to arrage the list based on persons height and highest front height person count

Comments (2)