/
rnekrasov
/
Python
Обзор
Документация
Войти
/
rnekrasov
/
Python
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
rotatelist.py
20 строк
525 B
slowy07
refactor: clean code
30 янв 2022, 04:33
30 янв 2022, 04:33
f0af0c4
Код
Авторство
О чём код?
N = int(input("Enter The Size Of Array")) list = [] for i in range(0, N): temp = int(input("Enter The Intger Numbers")) list.append(temp) # Rotating Arrays Using Best Way: # Left Rotation Of The List. # Let's say we want to print list after its d number of rotations. finalList = [] d = int(input("Enter The Number Of Times You Want To Rotate The Array")) for i in range(0, N): finalList.append(list[(i + d) % N]) print(finalList) # This Method holds the timeComplexity of O(N) and Space Complexity of O(N)