Problem
You have piles of candies, candies[i] in pile i. You can split a pile into smaller piles, but you cannot merge two piles. Give each of k children one pile, all of the same size. Some piles may go unused. Return the maximum number of candies each child can get (0 if you cannot give everyone even one candy).
Example 1
- Input
- candies = [5, 8, 6], k = 3
- Output
- 5
- Why
- piles of 5: one from 5, one from 8, one from 6
Example 2
- Input
- candies = [2, 5], k = 11
- Output
- 0
- Why
- only 7 candies for 11 children
Example 3
- Input
- candies = [4, 7, 5], k = 4
- Output
- 3
Constraints
1 <= candies.length <= 10^51 <= candies[i] <= 10^71 <= k <= 10^12