Search
⌘K

Leetcode 2966. Divide Array Into Arrays With Max Difference

Partition the array (n is a multiple of 3) into n/3 triplets such that within every triplet the max minus min ≤ k, returning any valid set of triplets or an empty array if impossible. The core task is to decide feasibility and construct such triplets — typically approached by exploiting ordering (e.g., sorting) and greedy grouping.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.