Remove duplicate elements in array
In a sorted Array, remove the duplicate elements
[1,1,2,2,3,3,3,4] -> [1,2,3,4]
High level:
Fast: Being processed index
Slow: left of slow is kept
Case 1: f == 0, copy f++ s++
Case 2: a[f] = a[s - 1], dont want, f++
Case 3:
Last updated
Was this helpful?