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 linked list, reverse the nodes of a linked list <em>k</em> at a time and return its modified list.</p>
<p><em>k</em> is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple of <em>k</em> then left-out nodes in the end should remain as it is.</p>
<ul>
</ul>
<p><strong>Example:</strong></p>
<p>Given this linked list: <code>1->2->3->4->5</code></p>
<p>For <em>k</em> = 2, you should return: <code>2->1->4->3->5</code></p>
<p>For <em>k</em> = 3, you should return: <code>3->2->1->4->5</code></p>
<p><strong>Note:</strong></p>
<ul>
<li>Only constant extra memory is allowed.</li>
<li>You may not alter the values in the list's nodes, only nodes itself may be changed.</li>