Cargando el ejercicio…
Imagine a carousel: elements move to the right, and the ones that pass the edge appear again at the beginning. The function rotate_right receives a list nums and shifts it cyclically to the right by k positions, returning a new list. The value of k may be larger than the list length, so remember to account for full rotations.
([1, 2, 3, 4, 5], 2)[4, 5, 1, 2, 3]([1, 2, 3], 0)[1, 2, 3]([1, 2, 3], 3)[1, 2, 3]def rotate_right(nums: list[int], k: int) -> list[int]:
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónThey run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.