An array walkthrough showing a slow pointer i and fast pointer j scanning a sorted list to remove duplicates in place. The animation highlights how j compares neighboring values while i marks where the next valid element should be written, illustrating the core two-pointer compaction pattern used in array deduplication problems. Useful for students studying in-place array algorithms and common coding-interview techniques like the 'remove duplicates' family of problems.
16:9 · every frame verified for overlaps, spacing and edges before rendering
class Solution { public int removeDuplicates(int[] nums) { int i=0; for(int j=0;j<nums.length;j++){ if(nums[j] == nums[i] && nums[j]==nums[j+1]){ continue; }else{ nums[i]=nums[j-1]; i++; }if(j==nums.length-1){ nums[i]=nums[j]; } } return i; } }