Very Simple Solution in Java


#1

public class Solution {
public int gcd(int A, int B) {
if(A==B){
return A;
}
if(A==0&&B!=0){
return B;
}
if(A!=0&&B==0){
return A;
}
return A%B==0? B : gcd(B,A%B);
}
}