Problem of the day
Given an integer ‘n’, return first n Fibonacci numbers using a generator function.
Input: ‘n’ = 5
Output: 0 1 1 2 3
Explanation: First 5 Fibonacci numbers are: 0, 1, 1, 2, and 3.
Note:
You don't need to print anything. Just implement the given function.
The first and only input line contains one integer, n, the required number of Fibonacci numbers to return.
Output format:
Return first n Fibonacci numbers using a generator function.
5
0 1 1 2 3
The first 5 Fibonacci numbers are 0, 1, 1, 2, and 3.
3
0 1 1
The first 5 Fibonacci numbers are 0, 1, 1.
The expected time complexity is O(n).
1 <= n <= 45
Time Limit: 1 s