Skip to content
Snippets Groups Projects
Commit 38a60f3d authored by Martin Mareš's avatar Martin Mareš
Browse files

DP: Bugfix @cache

parent d297a0cf
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ from functools import cache
def d2b(n):
if n <= 1:
return 1
return d2(n-1) + d2(n-2)
return d2b(n-1) + d2b(n-2)
# Tady počítáme tytéž podproblémy od nejmenšího k největšímu.
# Rekurzi jsme nahradili obyčejným cyklem, složitost je evidentně O(n).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment