What would be the Big-O for the following function?
for a in range(n):
for b in range(n - a):
for c in range(n - b):
if a + b + c == 0:
break
if a + b == 0:
break
if a == 0:
break
return n + 1
I was thinking that it would be O(N^3) since there is a triple nested for loop and each of the components of the for loop would have a Big O of O(N). Is my thinking correct or is there possibly a different Big-O for this function?