Answers for "remove duplicates from a given array"

0

remove duplicates from sorted array

def remove_duplicates(nums: [int]) -> int:
    cnt = 1
    for index in range(len(nums) - 1):
        if nums[index] != nums[index + 1]:
            nums[cnt] = nums[index + 1]
            cnt += 1
    print(cnt)
Posted by: Guest on December-29-2020

Code answers related to "remove duplicates from a given array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language