Oliver Eyton-Williams 0bd52f8bd1
Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
2020-11-27 10:02:05 -08:00

1000 B

id, title, challengeType, forumTopicId
id title challengeType forumTopicId
5a23c84252665b21eecc7e82 Greatest common divisor 5 302277

--description--

Write a function that returns the greatest common divisor of two integers.

--hints--

gcd should be a function.

assert(typeof gcd == 'function');

gcd(24,36) should return a number.

assert(typeof gcd(24, 36) == 'number');

gcd(24,36) should return 12.

assert.equal(gcd(24, 36), 12);

gcd(30,48) should return 6.

assert.equal(gcd(30, 48), 6);

gcd(10,15) should return 5.

assert.equal(gcd(10, 15), 5);

gcd(100,25) should return 25.

assert.equal(gcd(100, 25), 25);

gcd(13,250) should return 1.

assert.equal(gcd(13, 250), 1);

gcd(1300,250) should return 50.

assert.equal(gcd(1300, 250), 50);

--seed--

--seed-contents--

function gcd(a, b) {

}

--solutions--

function gcd(a, b) {
  return b==0 ? Math.abs(a):gcd(b, a % b);
}