forked from covalence-io/interview-prep-challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
14 lines (12 loc) · 781 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function fibonacci(digits) {
// For this, you are tasked with finding the Fibonacci series from the first digit until the nth digit in the series.
// The nth digit that you will be stopping at is given by the integer variable `digits`
// The Fibonacci series starts with 0 as the first digit, and 1 as the second digit.
// Each successive number is a sum of the previous two numbers
// The third digit is 1 (0+1), the fourth digit is 2 (1+1), the fifth digit is 3 (1+2)
// You will be returning an array of the numbers in the series
// Example: the digits variable you are given has a value of 10
// 0 and 1 are given as the first two, and you will end up returning [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
return null;
}
module.exports = fibonacci;