1 Star 0 Fork 0

wdc/Python001

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
rotatelist.py 521 Bytes
一键复制 编辑 原始数据 按行查看 历史
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ijiwei/Python001.git
git@gitee.com:ijiwei/Python001.git
ijiwei
Python001
Python001
master

搜索帮助