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 5636259

Browse files
Merge pull request #6 from AllThingsSmitty/feature_update
Feature update
2 parents 5465fa0 + ae3d6c3 commit 5636259

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,17 @@ 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) {
147-
if (n < 0)thrownewRangeError('Factorial is not defined for negative numbers');
148-
147+
if (n < 0)
148+
thrownewRangeError("Factorial is not defined for negative numbers");
149149
if (n === 0 || n === 1) return 1;
150-
151150
return n * factorial(n - 1);
152151
}
153152

0 commit comments

Comments
(0)

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