there square drop Xaxis 2d planeyou give 2D integer array position positionsi lefti sideLengthi represent ith square length sidelengthi drop left edge align Xcoordinate leftiEach square drop time height land square it fall downward negative Y direction land square Xaxis a square brushing leftright square count landing once land freeze place movedAfter square drop record height current tall stack squaresreturn integer array ans ansi represent height describe drop ith square Example 1input position 122361output 255explanationafter drop tall stack square 1 height 2after second drop tall stack square 1 2 height 5after drop tall stack square 1 2 height 5thus return answer 2 5 5example 2input position 100100200100output 100100ExplanationAfter drop tall stack square 1 height 100after second drop tall stack square 1 square 2 height 100thus return answer 100 100note square 2 brush right square 1 count land Constraints1 positionslength 10001 lefti 1081 sidelengthi 106