You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Given a singly linked list <em>L</em>: <em>L</em><sub>0</sub>→<em>L</em><sub>1</sub>→…→<em>L</em><sub><em>n</em>-1</sub>→<em>L</em><sub>n</sub>,<br />
reorder it to: <em>L</em><sub>0</sub>→<em>L</em><sub><em>n</em></sub>→<em>L</em><sub>1</sub>→<em>L</em><sub><em>n</em>-1</sub>→<em>L</em><sub>2</sub>→<em>L</em><sub><em>n</em>-2</sub>→…</p>
<p>You may <strong>not</strong> modify the values in the list's nodes, only nodes itself may be changed.</p>
<p><strong>Example 1:</strong></p>
<pre>
Given 1->2->3->4, reorder it to 1->4->2->3.</pre>
<p><strong>Example 2:</strong></p>
<pre>
Given 1->2->3->4->5, reorder it to 1->5->2->4->3.