Skip to content
C

Insert at Beginning of Linked List

Easyjavapythonccppjavascript

Given a linked list and a value X, insert a new node containing X at the beginning and print the resulting list.

Input Format

The first line contains an integer N. The second line contains N space-separated integers (empty if N is 0). The third line contains the integer X.

Output Format

Print the updated list from head to tail, separated by single spaces.

Input (stdin)

Output

Run your code to see output here...