Last active
March 24, 2018 10:53
-
-
Save rajatdiptabiswas/ae13dfea4a95a25e1112056c8e62ac79 to your computer and use it in GitHub Desktop.
The memoization decorator in Python to solve Dynamic Programming problems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def memoization(function): | |
memo = {} | |
def helper(x): | |
if x not in memo: | |
memo[x] = function(x) | |
return memo[x] | |
return helper | |
@memoization | |
def overlapping_recursion_problem(parameter): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment