Dsa
Math
Hard
Fibonacci Spiral
Given a positive integer n, create a Fibonacci spiral starting from the origin. The Fibonacci spiral consists of n quarter-circle arcs with radii corresponding to Fibonacci numbers. The first arc has a radius of 1, the second arc has a radius of 1, the third arc has a radius of 2, the fourth arc has a radius of 3, etc.
Input format:
- A single integer n (1 ≤ n ≤ 30).
Output format:
- A list of tuples representing the endpoints of each arc in the form (x, y) rounded to 2 decimal places.
Example:
Input:
5
Output:
[(1.0, 0.0), (1.0, 1.0), (0.0, 1.0), (0.0, 3.0), (2.0, 3.0)]
Key concepts
fibonaccigeometrysequence
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now