Skip to main content

Practice · 3 of 6

Dedup a sorted array in place

CHALLENGE
Difficulty: advanced+25 XP

Given an array **sorted ascending**, remove duplicates in place so each value appears once; return the new logical length. Elements beyond the returned length are ignored by the grader. Implement process(int[] arr) (return 0 for empty). Example: {1,1,2,3,3} → returns 3, first three cells {1,2,3}.

Back to lesson: Practice: Array lab: two passes, write indices, safe removal