Given an array, in one move you can increment any element by . Find the minimum moves to make all elements unique. For , increment one to . Answer is . For , answer is .
Think about what happens if you sort the array first. Duplicates become adjacent. Constraint: increments are unlimited, so every array has a solution. After sorting, duplicates cluster together, making it easy to detect violations. The final array will be a consecutive or near-consecutive sequence starting from the smallest element.