Inefficient Python w/ tail recursion:
def strongness_tail(n, a): return a if n % 2 == 1 else strongness_tail(n/2, 1 + a) def strongness(n): return strongness_tail(n, 0) def strongest_even(n, m): strongest = [-1, -1] for i in range(n, m+1): strength = strongness(i) if strength > strongest[0]: strongest = [strength, i] return strongest[1]
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Inefficient Python w/ tail recursion: