* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.1 KiB
1.1 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
5a23c84252665b21eecc8040 | Sum multiples of 3 and 5 | 5 | 302332 | sum-multiples-of-3-and-5 |
--description--
The objective is to write a function that finds the sum of all positive multiples of 3 or 5 below n.
--hints--
sumMults
should be a function.
assert(typeof sumMults == 'function');
sumMults(10)
should return a number.
assert(typeof sumMults(10) == 'number');
sumMults(10)
should return 23
.
assert.equal(sumMults(10), 23);
sumMults(100)
should return 2318
.
assert.equal(sumMults(100), 2318);
sumMults(1000)
should return 233168
.
assert.equal(sumMults(1000), 233168);
sumMults(10000)
should return 23331668
.
assert.equal(sumMults(10000), 23331668);
sumMults(100000)
should return 2333316668
.
assert.equal(sumMults(100000), 2333316668);
--seed--
--seed-contents--
function sumMults(n) {
}
--solutions--
function sumMults(n) {
var sum = 0;
for (var i = 1; i < n; i++) {
if (i % 3 == 0 || i % 5 == 0) sum += i;
}
return sum;
}