Each value in candies is the size of one pile. You may split piles into smaller piles, but cannot combine candies from different original piles. Give each of k children an equal number of candies, with each child receiving candies from just one original pile. Leftover candies may be unused. Return the largest possible number per child, or 0 if there are not enough candies to give everyone at least one.
Example 1:
Input: candies = [4,7]
k = 3
Output: 3Explanation: Give one child 3 candies from the pile of 4 and two children 3 each from the pile of 7. A portion of 4 would yield only two portions, which is not enough.
Example 2:
Input: candies = [2,3]
k = 6
Output: 0Explanation: There are only 5 candies for 6 children, so even one candy per child is impossible.
Example 3:
Input: candies = [8]
k = 2
Output: 4Explanation: Split the pile of 8 into two portions of 4. Both children receive 4 candies, using the entire pile.
Constraints:
1 <= candies.length <= 1000001 <= candies[i] <= 100000001 <= k <= 1000000000000