0026. Remove Duplicates from Sorted Array

Two Pointers — Interactive Step-by-Step Animation

slow = 0
for fast = 1 to n-1:
  if nums[fast] != nums[slow]:
    slow++
    nums[slow] = nums[fast]
return slow + 1
Press Step or Play to start the animation.
Array State:

Slow Pointer (write position)

0

Fast Pointer (scan position)

1

Unique Count (k)

-

Step

0

Log