We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5465fa0 + ae3d6c3 commit 5636259Copy full SHA for 5636259
README.md
@@ -136,18 +136,17 @@ console.log(fibonacci(6)); // Output: 8
136
137
**Explanation**: Generates the nth Fibonacci number recursively by summing the two preceding numbers.
138
139
-<sup>[Back to top](#algorithms)</sup>
140
-
141
⚠️ **Note**: This approach has exponential time complexity `O(2^n)` and is inefficient for large inputs.
142
+<sup>[Back to top](#algorithms)</sup>
+
143
### Factorial of a Number
144
145
```js
146
function factorial(n) {
147
- if (n < 0)thrownewRangeError('Factorial is not defined for negative numbers');
148
+ if (n < 0)
+thrownewRangeError("Factorial is not defined for negative numbers");
149
if (n === 0 || n === 1) return 1;
150
151
return n * factorial(n - 1);
152
}
153
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments