Problem Description
Given 2 non-negative integers A and B, find gcd(A, B).
GCD of 2 integers m and n is defined as the greatest integer g such that g is a divisor of both m and n.
Both A and B fit in a 32-bit signed integer.
NOTE: DO NOT USE LIBRARY FUNCTIONS
Problem Constraints
0 <= A <= 109
0 <= B <= 109
Input Format
The first argument is an integer A.
The second argument is an integer B.
Output Format
Return the Greatest Common Divisor of A and B
Example Input
Example Output
Example Explanation
Explanation 1:
3 is the GCD of 6 and 9
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified.
Still have a question? Checkout Sample Codes for more details.