Dsa
Arrays
Medium
Adjacent Duplicates Remover
Given an array of integers, remove all adjacent duplicates such that each number appears only once. The function must process the array in a single pass using extra space for the output. The input consists of a single line with integers separated by spaces. Print the modified array.
Example Input:
1 1 2 3 3 2 2 4
Example Output:
1 2 3 4
Key concepts
arraysstacksduplicates
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now