Skip to content

Latest commit

 

History

History
executable file
·
23 lines (10 loc) · 471 Bytes

Nth_Fibonacci.md

File metadata and controls

executable file
·
23 lines (10 loc) · 471 Bytes

Nth Fibonacci

Problem Statement

The Fibonacci sequence is dened as follows: the rst number of the sequence is 0, the second number is 1, and the nth number is the sum of the (n - 1)th and (n - 2)th numbers. Write a function that takes in an integer n and returns the nth Fibonacci number.

Sample input: 6

Sample output: 5 (0, 1, 1, 2, 3, 5)

Explanation

We can use a Stack here

Solution

Check this Python code.