Back to course home
0% completed
Vote For New Content
Two pointers solution (more clear)
amazonintern101
Aug 14, 2023
class Solution: def remove(self, arr): # TODO: Write your code here left, right = 0,1 while right < len(arr): if arr[left] != arr[right]: left += 1 arr[left] = arr[right] right += 1 return left + 1
0
0
Comments
Comments
sealess2 years ago
really wonderful! arr[left] as a index to identify if there is a new item occurs
On this page
Problem Statement
Try it yourself