<h2><a href="https://www.geeksforgeeks.org/problems/reverse-a-doubly-linked-list/1">Reverse a Doubly Linked List</a></h2><h3>Difficulty Level : Easy</h3><hr><div class="problems_problem_content__Xm_eO"><p><span style="font-size: 18px;">Given a <strong>doubly linked list </strong>of <strong>n </strong>elements. Your task is to <strong>reverse </strong>the doubly linked list <strong>in-place</strong>.</span></p>
<p><span style="font-size: 18px;"><strong>Example 1:</strong></span></p>
<pre><span style="font-size: 18px;"><strong>Input:
</strong>LinkedList: 3 &lt;--&gt; 4 &lt;--&gt; 5
<strong>Output: </strong>5 4 3
</span></pre>
<p><span style="font-size: 18px;"><strong>Example 2:</strong></span></p>
<pre><span style="font-size: 18px;"><strong>Input:
</strong>LinkedList: 75 &lt;--&gt; 122 &lt;--&gt; 59 &lt;--&gt; 196
<strong>Output: </strong>196 59 122 75</span>
</pre>
<p><span style="font-size: 18px;"><strong>Your Task:</strong><br>Your task is to complete the given function <strong>reverseDLL()</strong>, which takes <strong>head </strong>reference as argument and this function should <strong>reverse </strong>the elements such that the <strong>tail </strong>becomes the <strong>new head </strong>and all pointers are pointing in the right order. You need to <strong>return </strong>the <strong>new head</strong> of the reversed list. The <strong>printing </strong>and <strong>verification </strong>is done by the <strong>driver </strong>code.</span></p>
<p><span style="font-size: 18px;"><strong>Expected Time Complexity:&nbsp;</strong>O(n).<br><strong>Expected Auxiliary Space:&nbsp;</strong>O(1).</span></p>
<p><span style="font-size: 18px;"><strong>Constraints:</strong><br>1 &lt;= number of nodes &lt;= 10<sup>4</sup><br>0 &lt;= value of nodes &lt;= 10<sup>4</sup></span></p></div><p><span style=font-size:18px><strong>Company Tags : </strong><br><code>D-E-Shaw</code>&nbsp;<code>Adobe</code>&nbsp;<br><p><span style=font-size:18px><strong>Topic Tags : </strong><br><code>doubly-linked-list</code>&nbsp;<code>Linked List</code>&nbsp;<code>Data Structures</code>&nbsp;