Rotate a list
mediumLists20 XP
Rotate nums to the right by k places: the last k items move to the front. k can be larger than the list.
Examples
- Input: nums = [1, 2, 3, 4, 5], k = 2Output: [4, 5, 1, 2, 3]
- Input: nums = [1, 2, 3], k = 3Output: [1, 2, 3]
Examples use JSON: true/false/null are True/False/None in Python.