Java Solution Using Big Integer


#1

import java.math.*;
public class Solution {
public int gcd(int A, int B) {
BigInteger s = new BigInteger(String.valueOf(A));
BigInteger g = new BigInteger(String.valueOf(B));
BigInteger f = s.gcd(g);
return f.intValue();
}
}