3659. Partition Array Into K-Distinct Groups
You are given an integer array
numsand an integerk.Your task is to determine whether it is possible to partition all elements of
numsinto one or more groups such that:
- Each group contains exactly
kdistinct elements.- Each element in
numsmust be assigned to exactly one group.Return
trueif such a partition is possible, otherwise returnfalse.
1 | class Solution { |