n = int(input())
L = []
for i in range(n): # --> O(n+1) #!
for j in range(n): # --> O(n+1(n+1)) = O(n^2+2n+1) #NESTED!
L.append(i**j) # --> O(n*n) k=depth of loops -> k*=n -> O(n^2)
for i in range(n): #---> O(n+1) #INDEPENDENT NEW LOOP
l = L[:] + [i] #----> O(n)
### ----> Total = O(2n^2+5n+3) ==> O(n^2)
1条答案
按热度按时间qacovj5a1#