Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Fix a Fibonacci Coding Issue

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Fix a Fibonacci Coding Issue. 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.

You need to log in / sign up to run or submit.

Problem

Fix a coding issue involving a Fibonacci sequence.

Asked in the Technical Round stage as a live coding and debugging prompt. Implement the corrected function using zero-based indexing: fibonacci(0) = 0, fibonacci(1) = 1, and fibonacci(n) = fibonacci(n - 1) + fibonacci(n - 2) for n > 1.

Input and Output

n is a non-negative integer. Return the nth Fibonacci number as an integer.

Constraints

  • 0 <= n <= 1000
  • Return the value using zero-based indexing
  • The result must be exact

Function Signature

def fibonacci(n):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output