I have the following code and want to calculate the time complexity:
def solve(n):
if n == 0 or n == 2:
return True
elif n == 1:
return False
else:
return not solve(n-1) or not solve(n-2) or not solve(n-3)
If I had something like this:
return solve(n-1) + solve(n-2)
it would be T(n) = 2T(n-1), at least from my understanding.
But how do I proceed if I have an "or" in the return statement?
return not solve(n-1) or not solve(n-2) or not solve(n-3)