fruit available position infinite xaxis you give 2D integer array fruit fruitsi positioni amounti depict amounti fruit position positioni fruit sort positioni ascending order positioni uniqueyou give integer startpos integer k Initially position startpos from position walk leave right it take step unit xaxis walk k step total for position reach harvest fruit position fruit disappear positionreturn maximum total number fruit harvest Example 1input fruit 286386 startpos 5 k 4output 9explanation the optimal way move right position 6 harvest 3 fruit move right position 8 harvest 6 fruitsYou move 3 step harvest 3 6 9 fruit totalexample 2input fruit 0941576274109 startpos 5 k 4Output 14explanation you k 4 step reach position 0 10the optimal way Harvest 7 fruit start position 5 move leave position 4 harvest 1 fruit move right position 6 harvest 2 fruit move right position 7 harvest 4 fruitsYou move 1 3 4 step harvest 7 1 2 4 14 fruit totalexample 3input fruit 036485 startpos 3 k 2output 0explanationyou k 2 step reach position fruit Constraints1 fruitslength 105fruitsilength 20 startpos positioni 2 105positioni1 positioni 0 0indexed1 amounti 1040 k 2 105