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;