Skip to content

Instantly share code, notes, and snippets.

@rajatdiptabiswas
Last active March 24, 2018 10:53
Show Gist options
  • Save rajatdiptabiswas/ae13dfea4a95a25e1112056c8e62ac79 to your computer and use it in GitHub Desktop.
Save rajatdiptabiswas/ae13dfea4a95a25e1112056c8e62ac79 to your computer and use it in GitHub Desktop.
The memoization decorator in Python to solve Dynamic Programming problems
#!/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