Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ExampleE committed Dec 15, 2024
1 parent 5891c38 commit 43d2ac5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@


def cache(func: Callable) -> Callable:
# Write your code here
pass
result_cache = {}

def wrapper(*args):
if args not in result_cache:
print("Calculating new result")
result = func(*args)
result_cache[args] = result
return result
else:
print("Getting from cache")
return result_cache[args]
return wrapper

0 comments on commit 43d2ac5

Please sign in to comment.