Remove Duplicates Sorted Array In Place Problem
Remove Duplicates Sorted Array In Place Problem — ExecCode School DSA Practice
Solve the Remove Duplicates Sorted Array In Place problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You are given a list of numbers that are already sorted from smallest to largest. Your task is to count how many different numbers there are in this list and print that count. Some numbers might be repeated in the list.
Examples
Input 5 1 1 2 2 3; Output 3. Input 5 1 2 3 4 5; Output 5
Constraints
1 <= n <= 10^5
Practice Remove Duplicates Sorted Array In Place free on ExecCode. Browse DSA problems, topic map, and placement guides.