freeCodeCamp/curriculum/challenges/arabic/08-coding-interview-prep/rosetta-code/fibonacci-n-step-number-seq...

74 lines
1.9 KiB
Markdown
Raw Normal View History

---
title: Fibonacci n-step number sequences
id: 598eef80ba501f1268170e1e
challengeType: 5
videoUrl: ''
localeTitle: ''
---
## Description
undefined
## Instructions
undefined
## Tests
<section id='tests'>
```yml
tests:
- text: ''
testString: 'assert(typeof fib_luc === "function", "<code>fib_luc</code> is a function.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(2,10,"f"),ans[0],"<code>fib_luc(2,10,"f")</code> should return <code>[1,1,2,3,5,8,13,21,34,55]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(3,15,"f"),ans[1],"<code>fib_luc(3,15,"f")</code> should return <code>[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(4,15,"f"),ans[2],"<code>fib_luc(4,15,"f")</code> should return <code>[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(2,10,"l"),ans[3],"<code>fib_luc(2,10,"l")</code> should return <code>[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(3,15,"l"),ans[4],"<code>fib_luc(3,15,"l")</code> should return <code>[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(4,15,"l"),ans[5],"<code>fib_luc(4,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]</code>.");'
- text: ''
testString: 'assert.deepEqual(fib_luc(5,15,"l"),ans[6],"<code>fib_luc(5,15,"l")</code> should return <code>[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]</code>.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function fib_luc (n, len, w) {
// Good luck!
}
```
</div>
### After Test
<div id='js-teardown'>
```js
console.info('after the test');
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>