Tiny Left Rotation
Rotating a list is like a small carousel: the first element moves to the end, and the others shift left. Write a function rotate_left3 that takes a list nums with exactly 3 numbers. Return a new list after rotating it one position to the left.
Примеры
Ввод
[1, 2, 3]Вывод
[2, 3, 1]Ввод
[5, 11, 9]Вывод
[11, 9, 5]Ввод
[7, 0, 0]Вывод
[0, 0, 7]Нужно реализовать
def rotate_left3(nums: list[int]) -> list[int]:
Теги
listsarray
Влез, за да видиш историята на решенията
ВходВлез, за да използваш ИИ ментора
ВходVisible tests
1
Input
[1,2,3]Expected
[2,3,1]2
Input
[5,11,9]Expected
[11,9,5]3
Input
[7,0,0]Expected
[0,0,7]4
Input
[1,1,1]Expected
[1,1,1]5
Input
[0,1,2]Expected
[1,2,0]6
Input
[0,0,0]Expected
[0,0,0]Focus radio
Paused · SomaFM · Fluid