Showing:
Handle Score
@Ibrahim Nash 5725
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
The Nth Fibonnaci
Easy Accuracy: 16.37% Submissions: 768 Points: 2

Given a positive integer N, find the last digit of the Nth term from the Fibonacci series.

Example 1:

Input:
N = 5
Output:
5
Explanation:
5th Fibonacci number is 5

Example 2:

Input:
N = 14
Output:
7
Explanation:
14th Fibonacci number is 377
It's last digit is 7


You don't need to read input or print anything. Your task is to complete the function fib() which takes an integer N as input parameter and returns the last digit of Nth Fibonacci number.

Expected Time Complexity: O(N)
Expected Space Complexity: O(1)

Constraints:
1 <= N <= 1000

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:

The Nth Fibonnaci