How to find GCD of two numbers ?

[Question]: There is two number find the Greatest common divisor example 3,6 – GCD is 3Better Approach using Euclidean algorithm Here we used recursion which swap the params with second argument as modulo divisor.The space complexity is O(log(min(a,b))) as well, due to the recursive calls being placed on the call stack. Each recursive call consumes …

How to find GCD of two numbers ? Read More »