What will be the time complexity of this loop?
Anonymous User
56

for i in range(len(list)):

    subArray1Sum = sum(list[0:i])
    subArray2Sum = sum(list[i:len(list)])     

Confused about the sum function within the loop. Will it be O(n) or as it is using sum function twice is it O(n^3) ?

Comments (1)