Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a0fef1e

Browse files
Minor edit
1 parent 5465fa0 commit a0fef1e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

‎README.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,16 @@ console.log(fibonacci(6)); // Output: 8
136136

137137
**Explanation**: Generates the nth Fibonacci number recursively by summing the two preceding numbers.
138138

139-
<sup>[Back to top](#algorithms)</sup>
140-
141139
⚠️ **Note**: This approach has exponential time complexity `O(2^n)` and is inefficient for large inputs.
142140

141+
<sup>[Back to top](#algorithms)</sup>
142+
143143
### Factorial of a Number
144144

145145
```js
146146
function factorial(n) {
147147
if (n < 0) throw new RangeError('Factorial is not defined for negative numbers');
148-
149148
if (n === 0 || n === 1) return 1;
150-
151149
return n * factorial(n - 1);
152150
}
153151

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /