'Coding has over 700 languages', '67% of programming jobs aren’t in the
technology industry', 'Coding is behind almost everything that is powered
by electricity'

Topics

You are given a doubly-linked list of size * 'N'*, consisting of positive integers. Now your task is to reverse it and return the head of the modified list.

```
A doubly linked list is a kind of linked list that is bidirectional, meaning it can be traversed in both forward and backward directions.
```

Example:

```
Input:
4
4 3 2 1
This means you have been given doubly linked list of size 4 = 4 <-> 3 <-> 2 <-> 1.
Output:
1 2 3 4
This means after reversing the doubly linked list it becomes 1 <-> 2 <-> 3 <-> 4.
```

Detailed explanation

```
8
1 2 3 4 5 6 7 8
```

```
8 7 6 5 4 3 2 1
```

```
Input: 1 <-> 2 <-> 3 <-> 4 <-> 5 <-> 6 <-> 7 <-> 8
Output: 8 <-> 7 <-> 6 <-> 5 <-> 4 <-> 3 <-> 2 <-> 1
Explanation: It's self explanatory.
```

```
5
5 8 4 9 1
```

```
1 9 4 8 5
```

```
1 <= 'N' <= 10^3
0 <= 'data' <= 10^3
Where 'N' is the size of the doubly linked list.
Time Limit: 1 sec
```