Challenge: Construct a Double-Linked List

This lesson brings you a challenge to solve.

Problem statement

Write a function that takes an integer n as a parameter, creates a double-linked list and returns it after adding values to it from 1 to n.

Input

An integer

Sample Input

5

Output

Double-linked list

Sample Output

[1,2,3,4,5]

Try to implement the function below. Feel free to view the solution, after giving it a few shots. Good Luck!

Get hands-on with 1200+ tech skills courses.