How to convert recursive “divide and conquer” function to a dynamic programming function using decorators?
问题 I am trying to write a decorator function which converts a pure recursive function with two arguments that uses a "divide and conquer" strategy to an equivalent but more efficient one using dynamic programming. Note: it is designated to decorate two input functions. So I am trying to memoize the values but I am not sure how to correctly implement it in the form of a decorator? Also how can it decorate two input functions? EDIT: This is what I have managed to do: profile_results = {} t = {} ''