---
title: "Discussion on \"945. Minimum Increment to Make Array Unique\" | Hashnode"
description: "Discussion on \"945. Minimum Increment to Make Array Unique\". class Solution:\n    def minIncrementForUnique(self, nums: List[int]) -> int:\n        nums.sort()\n        ans = 0\n\n        for i in range(len(nums) - 1):\n            if nums[i] >= nums[i + 1]:\n                ans += 1 + (nums[i] - nums[i + 1])\n       ..."
url: "https://hashnode.com/posts/945-minimum-increment-to-make-array-unique/666bc3cd06c2cd21b1e5d26a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [945\. Minimum Increment to Make Array Unique](https://tapanrachchh.hashnode.dev/945-minimum-increment-to-make-array-unique?utm_source=hashnode&utm_medium=feed)

class Solution: def minIncrementForUnique(self, nums: List\[int\]) -> int: nums.sort() ans = 0 for i in range(len(nums) - 1): if nums\[i\] >= nums\[i + 1\]: ans += 1 + (nums\[i\] - nums\[i + 1\]) ...

Jun 14, 2024 · 1 min read · tapanrachchh.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#leetcode](https://hashnode.com/tag/leetcode)
-   [#counting-sort](https://hashnode.com/tag/counting-sort)
-   [#sorting](https://hashnode.com/tag/sorting)

## Written by

[Tapan Rachchh](https://hashnode.com/@tapanrachchh)

@tapanrachchh

  
[View profile](https://hashnode.com/@tapanrachchh)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
