Skip to content
CampusEduX

Remove Duplicates from Sorted Linked List

Easyjavapythonccppjavascript

Given a sorted linked list, remove nodes with repeated values so that every value appears only once.

Input Format

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

Output Format

Print the list after removing duplicates, separated by single spaces.

Related Problems

  • Create and Traverse a Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Insert at Beginning of Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Insert at End of Linked List
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...