Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Replaced "n+1" to "n-1"
It could be a typo but wrong solution.
  • Loading branch information
kapilraghuwanshi authored Sep 5, 2021
commit 5c2a523d2d3e15a7f3e70c3b382161bc017e14d5
2 changes: 1 addition & 1 deletion chapter08/8.01 - Triple Step/tripleStepv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Recursion and Dynamic Programming (4 steps)
function tripleStep(n, res = 0) {
if (n < 0) return 0;
if (n === 0) return 1;
return tripleStep(n + 1) + tripleStep(n - 2) + tripleStep(n - 3);
return tripleStep(n - 1) + tripleStep(n - 2) + tripleStep(n - 3);
}

// Top Down Memoization
Expand Down