Rotate Linked List
LINKED LIST

Problem

Given the head of a linked list and a non-negative integer k, rotate the list to the right by k places, and return the head of the rotated list.

Examples

rotateRight([0,1,2], 2); // returns [2,0,1] // [0,1,2] -> [2,0,1] -> [1,2,0]
Loading...