Deal numbers into k equal piles
Given a list nums of positive integers and an integer k, return True if you can deal every number into one of k piles so that all k piles have the same sum, otherwise False. Each number goes into exactly one pile, and a pile can hold any count of numbers.
1 ≤ k ≤ len(nums) ≤ 16 and 1 ≤ nums[i] ≤ 10,000. Some inputs have no answer but a huge number of near misses: those must still finish fast.
Besides the tests, one large input (14 numbers into 6 piles) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
can_deal_evenly([4,3,2,3,5,2,1], 4)→truecan_deal_evenly([1,2,3,4], 3)→falsecan_deal_evenly([2,2,2,2,3,4,5], 4)→false