โ† All coding problems

Greatest common divisor

EasyMaths

Return the greatest common divisor of two positive integers a and b (Euclid's algorithm).

Function
function solve(a, b)
Example 1
a = 12
b = 18
โ†’ 6

Submit also runs 3 hidden tests, including edge cases.

console.log output is shown below