Showing:
Handle Score
@Ibrahim Nash 5761
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4944
@saiujwal13083 4506
@sanjay05 3762
@marius_valentin_dragoi 3516
@sushant_a 3459
@verma_ji 3341
@KshamaGupta 3318
GCD and Fibonacci Numbers
Easy Accuracy: 0.0% Submissions: 8 Points: 2

You will be given two positive numbers M and N. Your task is to print the greatest common divisor of Fib(M) and Fib(N) where Fib(x) means the x'th Fibonacci numbers defined as:

Fib(0) = 0
Fib(1) = 1
for n > 1, Fib(n) = Fib(n-1) + Fib(n-2)

Example 1:

Input: M = 3, N = 6
Output: 2
Explanation: Fib(3) = 2 and Fib(6) = 8
So, GCD(2,8)%100 = 2

â€‹Example 2:

Input: M = 7, N = 8
Output: 1
Explanation: Fib(7) = 13 and Fib(8) = 21
So, GCD(13,21)%100 = 1

You don't need to read input or print anything. Your task is to complete the function fibGcd() which takes M and as inputs and returns the answer.The answer may be very large, compute the answer modulo 100
.

Expected Time Complexity: O(min(M, N))
Expected Auxiliary Space: O(1)

Constraints:
1 ≤ M, N ≤ 103