Skip to content
C

Remove Duplicates Using Two Pointers

Easyjavapythonccppjavascript

Given a sorted array, remove duplicate values in-place using a two-pointer approach, and report the number of unique values and the unique values themselves.

Input Format

The first line contains an integer N. The second line contains N space-separated integers in non-decreasing order.

Output Format

Print two lines: Count = C Values = v1 v2 ... (the distinct values in increasing order, space-separated).

Input (stdin)

Output

Run your code to see output here...