Skip to content

Commit e30097b

Browse files
committed
added 945
1 parent 8c43386 commit e30097b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def minIncrementForUnique(self, nums: List[int]) -> int:
3+
nums.sort()
4+
res = 0
5+
6+
for i in range(1, len(nums)):
7+
if nums[i - 1] >= nums[i]:
8+
res += 1 + nums[i - 1] - nums[i]
9+
nums[i] = nums [i - 1] + 1
10+
11+
return res

0 commit comments

Comments
 (0)