Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究编码面试,我不确定是否应该使用:
for i in range(len(arr)-1,-1,-1): print(arr(i))
因为它显然是 O(n)?
切片和反转是否会将时间复杂度增加到 O(n^2)?
for n in arr[::-1]: print(n) for n in reversed(arr): pring(n)