zajebis
This commit is contained in:
40
src/problems/fibonacisequence/description.md
Normal file
40
src/problems/fibonacisequence/description.md
Normal file
@@ -0,0 +1,40 @@
|
||||
## Fibonacci Number
|
||||
|
||||
Write a function called `fibonacci` that takes a non-negative integer `n` as input and returns the **n-th Fibonacci number**.
|
||||
|
||||
The Fibonacci sequence is defined as:
|
||||
|
||||
* `F(0) = 0`
|
||||
* `F(1) = 1`
|
||||
* `F(n) = F(n-1) + F(n-2)` for `n > 1`
|
||||
|
||||
### Function Signature:
|
||||
|
||||
```python
|
||||
def fibonacci(n):
|
||||
# return your solution
|
||||
```
|
||||
|
||||
#### Requirements
|
||||
|
||||
* The function should return the `n`-th number in the Fibonacci sequence.
|
||||
* If `n` is less than `0`, print `"Incorrect input"`.
|
||||
* Your function will be tested with:
|
||||
|
||||
* Base cases (`n = 0` and `n = 1`)
|
||||
* Small values of `n`
|
||||
* Larger values of `n` (e.g., 9)
|
||||
* Multiple test cases in sequence
|
||||
|
||||
#### Example:
|
||||
|
||||
```python
|
||||
fibonacci(0) # returns 0
|
||||
fibonacci(1) # returns 1
|
||||
fibonacci(2) # returns 1
|
||||
fibonacci(3) # returns 2
|
||||
fibonacci(5) # returns 5
|
||||
fibonacci(9) # returns 34
|
||||
```
|
||||
|
||||
You can copy this into your problem’s solution description.
|
||||
Reference in New Issue
Block a user