Please enter your email address or userHandle.
Given a positive integer N, find the last digit of the Nth term from the Fibonacci series.
N = 5
5th Fibonacci number is 5
N = 14
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)
1 <= N <= 1000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.