Linked List
61. Rotate List
Two moves make this clean. First, k can be huge (up to 2·10⁹) while the list is short, and rotating by a full length is a no-op — so the real shift is k % length. Second, temporarily close the list…
Loading…
Two moves make this clean. First, k can be huge (up to 2·10⁹) while the list is short, and rotating by a full length is a no-op — so the real shift is k % length. Second, temporarily close the list…
Loading…