Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Generate Fibonacci Sequence
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Write a function that generates the first n Fibonacci numbers.
Sample Input:
5
Sample Output:
[0, 1, 1, 2, 3]
Hints
Hint 1
Fibonacci: each number is sum of the two preceding ones
Hint 2
Start with 0 and 1
Hint 3
Use a loop to generate the sequence
Code Editor
Reset
Run
Save
Loading...