Split into k equal groups

Write can_partition(nums, k) that returns whether the positive whole numbers can be divided into k non-empty groups with equal sums.

can_partition([4, 3, 2, 3, 5, 2, 1], 4)  ->  True     (5), (1,4), (2,3), (2,3)
can_partition([1, 2, 3, 4], 3)           ->  False

Backtracking with k buckets: place each number (largest first) into a bucket that still has room, undo on failure. Skip buckets with the same current total as one already tried.

def can_partition(nums, k):
    ...