you give 0indexed integer array candy each element array denote pile candy size candiesi you divide pile number sub pile merge pile togetheryou give integer k you allocate pile candy k child child get number candy each child pile candy pile candy unusedreturn maximum number candy child Example 1input candy 586 k 3output 5explanation we divide candies1 2 pile size 5 3 candies2 2 pile size 5 1 we pile candy size 5 5 3 5 1 we allocate 3 pile size 5 3 child it prove child receive 5 candiesExample 2input candy 25 k 11output 0explanation there 11 child 7 candy total impossible ensure child receive candy Thus child get candy answer 0 Constraints1 candieslength 1051 candiesi 1071 k 1012