#3659

Partition Array Into K-Distinct Groups

specialist · 950 · lc medium +32 · 47% accepted · 113 likes · top 32%

Description

Given an integer array nums and integer k, determine whether nums can be partitioned into groups of exactly k elements such that all elements within each group are distinct and every element is assigned to exactly one group. Return true if possible, otherwise false.

Code

1
2
3