Medium
The Fibonacci sequence is a sequence of integers such that each term is the sum of the two previous ones and begins with a 1. How should the following code be modified to make it work? :
function fibonacci(n)
{
return fibonacci(n-1) + fibonacci(n-2);
}
display fibonacci(10);
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
5
What does the While loop do?2
What is the complexity of this algorithm?9
What is recursion?7
What is special about quick sort?6
What type of structure are the results of a recursive function stored in?2
Given an array of 17 elements sorted in ascending order, what is the cost of accessing the element with index 10?2
What about the merge sort method?