← Practice
Algorithms·medium 18 min 75 XP

Fibonacci

Return the nth Fibonacci number (0-indexed: fib(0) = 0, fib(1) = 1).

Examples

  • fibonacci(6) → 8

Constraints

  • Keep the required function name so the tests can find it
  • Return a value instead of only logging it
  • Do not mutate inputs unless the challenge asks you to
Fibonacci · editor

Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.