Handle Score
@Ibrahim Nash 6420
@blackshadows 6376
@mb1973 5604
@Quandray 5231
@akhayrutdinov 5111
@saiujwal13083 4510
@sanjay05 3762
@kirtidee18 3673
@marius_valentin_dragoi 3522
@sushant_a 3459
@verma_ji 3413
Complete Leaderboard
Print first n Fibonacci Numbers
Basic Accuracy: 50.31% Submissions: 11713 Points: 1

Given a number N, find the first N Fibonacci numbers. The first two number of the series are 1 and 1.

Example 1:

N = 5
Output: 1 1 2 3 5

Example 2:

N = 7
Output: 1 1 2 3 5 8 13

Your Task:
Your task is to complete printFibb() which takes single argument N and returns a list of first N Fibonacci numbers.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
Note: This space is used to store and return the answer for printing purpose.

1<= N <=84


to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Print first n Fibonacci Numbers

Output Window