id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us arrays > fibonacci
prev  |  next  |  chance

The Fibonacci numbers are a sequence of integers starting with 0, 1, 1, 2, 3, 5, ... The next number in the sequence can be found by adding the two previous numbers. So the next number in the above sequence is 8 since 3+5=8. Given an integer n, return an array containing the first n Fibonacci numbers. You may assume that n will be a resonably small non-negative integer.


fibonacci(1) → [0]
fibonacci(3) → [0, 1, 1]
fibonacci(5) → [0, 1, 1, 2, 3]

...Save, Compile, Run (ctrl-enter)

public int[] fibonacci(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy