How can I find the time complexity of this function:
def f(lst, d, u):
# assume 0<=d<=u<n where n is the length of the list
if lst[d] == lst[u]:
return u-d
return max(f(lst, d+1, u), f(lst, d, u-1))
What this function does is find the largest value which appears twice in the list in the range between d
and u