Time complexity of Python lambda [closed]

f=lambda a:a and max([a[:1],a[:1]+f(a[2:]),f(a[1:])],key=sum)or a

It prints out the output subarray for the House Robber problem. What’s the time complexity of this lambda function? I’m thinking n log n because it applies f to multiple slices of a? I’m not too familiar with how time complexity works in lambda functions.

Source: Python Questions

LEAVE A COMMENT