Your question is Coding: Fibonacci Implementation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
TikTok Shop may use simple numerical sequences when prototyping ranking or pacing logic. Implement a function that returns the first n Fibonacci numbers in order.
The Fibonacci sequence is defined as F(0) = 0, F(1) = 1, and F(k) = F(k - 1) + F(k - 2) for k >= 2.
Given a non-negative integer n, return a list containing exactly n integers: [F(0), F(1), ..., F(n - 1)]. For n = 0, return an empty list. You may assume results fit within Python's integer representation.
def fibonacci(n):