mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -04:00
Update and rename array-remove-duplicate-inplace.py to remove_dups_inplace.py
This commit is contained in:
parent
2f1db3f84e
commit
b81ccd579b
@ -2,7 +2,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# author: bt3gl
|
# author: bt3gl
|
||||||
|
|
||||||
### Remove Duplicates from Sorted Array in-place
|
|
||||||
|
|
||||||
|
|
||||||
def remove_duplicates(nums: list[int]) -> int:
|
def remove_duplicates(nums: list[int]) -> int:
|
||||||
@ -23,10 +22,3 @@ def remove_duplicates(nums: list[int]) -> int:
|
|||||||
|
|
||||||
return dup_i - arr_i - 1, nums
|
return dup_i - arr_i - 1, nums
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
|
||||||
|
|
||||||
nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
|
|
||||||
assert(remove_duplicates(nums) == (5, [0, 1, 2, 3, 4, '_', '_', '_', '_', '_']))
|
|
Loading…
x
Reference in New Issue
Block a user