dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.0 KiB
1.0 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6a1d9f98e819ed70a0e994dd | Challenge 331: Nearest Multiple | 28 | challenge-331 |
--description--
Given two integers, round the first to the nearest multiple of the second.
--hints--
roundToNearestMultiple(5, 3) should return 6.
assert.equal(roundToNearestMultiple(5, 3), 6);
roundToNearestMultiple(17, 4) should return 16.
assert.equal(roundToNearestMultiple(17, 4), 16);
roundToNearestMultiple(43, 5) should return 45.
assert.equal(roundToNearestMultiple(43, 5), 45);
roundToNearestMultiple(38, 11) should return 33.
assert.equal(roundToNearestMultiple(38, 11), 33);
roundToNearestMultiple(93, 12) should return 96.
assert.equal(roundToNearestMultiple(93, 12), 96);
--seed--
--seed-contents--
function roundToNearestMultiple(num, multiple) {
return num;
}
--solutions--
function roundToNearestMultiple(num, multiple) {
return Math.round(num / multiple) * multiple;
}