Company: HirePro

Difficulty: medium

Problem Statement

Remove Duplicates from a Sorted List You are given a list of integers sorted in nondecreasing order. Remove duplicate values so that every distinct value appears once, while preserving the original order of the remaining values. Input Format The first line contains an integer `n`, the number of elements. The second line contains `n` sorted integers. Output Format Print the list after duplicates have been removed, separated by single spaces. Constraints `1 <= n <= 200000`. Each value fits in a signed 32-bit integer. Example Input `7` `1 1 2 2 2 4 5` Output `1 2 4 5` Notes The input is already sorted. A single left-to-right traversal is sufficient.

More HirePro OA questionsInterview experiences