The Additive Chain
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L3
Problem
Given non-negative integer n, return the first n Fibonacci numbers starting with 0, 1, 1, 2, 3, 5, ... Use iteration, not recursion. Return [] when n = 0.
Summary
Each value is the sum of the two before it - no calls to itself allowed.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.