Create and Traverse a Linked List
Easyjavapythonccppjavascript
Given a list of values, build a singly linked list in that order and print its values from head to tail.
Input Format
The first line contains an integer N. The second line contains N space-separated integers.
Output Format
Print the N values in head-to-tail order, separated by single spaces.
Example 1
Input
3 10 20 30
Output
10 20 30
Explanation: The nodes are connected in input order.
- 1 <= N <= 100000
- -1000000000 <= value <= 1000000000