> For the complete documentation index, see [llms.txt](https://chiragjain.gitbook.io/neetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chiragjain.gitbook.io/neetcode/61-rotate-list.md).

# 61. Rotate List

## Medium

***

Given the `head` of a linked list, rotate the list to the right by `k` places.

&#x20;

**Example 1:**

![](https://assets.leetcode.com/uploads/2020/11/13/rotate1.jpg)

<pre><code>Input: head = [1,2,3,4,5], k = 2
<strong>Output:
</strong> [4,5,1,2,3]
</code></pre>

**Example 2:**

![](https://assets.leetcode.com/uploads/2020/11/13/roate2.jpg)

<pre><code>Input: head = [0,1,2], k = 4
<strong>Output:
</strong> [2,0,1]
</code></pre>

&#x20;

**Constraints:**

* The number of nodes in the list is in the range `[0, 500]`.
* `-100 <= Node.val <= 100`
* `0 <= k <= 2 * 109`
