FunctionRacerProblemsRace

Greatest Common Divisor

EasyMathPython, JavaScript, TypeScript

Return the largest positive integer that divides both a and b. Do not use math.gcd.

Example 1

a 12
b 18
returns 6

6 divides both.

Example 2

a 7
b 13
returns 1

Only 1 divides both.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems