Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Generate an infinite Fibonacci sequence using Enumerator::Lazy and retrieve the first `n` Fibonacci numbers.

Hard

Problem Statement

Generate an infinite Fibonacci sequence using Enumerator::Lazy and retrieve the first n Fibonacci numbers.

Sample Input

n = 10

Sample Output

[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
def fibonacci_lazy(n) # Your code here end puts fibonacci_lazy(10)
Log in or sign up to run or submit your code.Log inSign up
Input
n = 10
Expected Output
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]