Challenge 1: Find the Greatest Common Divisor
In this lesson, we will find the greatest common divisor (GCD) using recursion.
We'll cover the following
What is GCD?
The GCD of two integers is the largest integer that can fully divide both numbers, without a remainder.
How to find GCD?
What is the greatest common divisor of 54 and 36?
The number can be expressed as a product of two integers in several different ways:
Thus the divisors for are .
The number can be expressed as a product of two integers in several different ways:
Thus the divisors for are .
Common divisors are and . The greatest common divisor or GCD for and is .
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.