From ffa7fc53abac7997e5fea1f5174a8e1eac12e126 Mon Sep 17 00:00:00 2001 From: Money Making Mitch Date: Tue, 14 Apr 2026 12:12:03 -0700 Subject: [PATCH] Simplify base case handling in tripleStep function --- chapter08/8.01 - Triple Step/tripleStepv2.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/chapter08/8.01 - Triple Step/tripleStepv2.js b/chapter08/8.01 - Triple Step/tripleStepv2.js index 32ae4d8..455e8f4 100644 --- a/chapter08/8.01 - Triple Step/tripleStepv2.js +++ b/chapter08/8.01 - Triple Step/tripleStepv2.js @@ -36,9 +36,7 @@ function tripleStep(n, memo = [1, 1, 2, 4]) { // Constant Space // Time O(n) & Space O(1) function tripleStep(n) { - if (n <= 0) return 0; - if (n === 1) return 1; - if (n === 2) return 2; + if (n <= 2) return n; let a = 1; let b = 1;