diff --git a/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json b/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json index c9371abbb9..8e8b8b8dec 100644 --- a/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json +++ b/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json @@ -815,17 +815,19 @@ "type": "bonfire", "title": "Problem 19: Counting Sundays", "tests": [ - "assert.strictEqual(euler19(), 171, 'message: euler19() should return 171.');" + "assert.strictEqual(countingSundays(1943, 1946), 6, 'message: countingSundays(1943, 1946) should return 6.');", + "assert.strictEqual(countingSundays(1995, 2000), 9, 'message: countingSundays(1995, 2000) should return 9.');", + "assert.strictEqual(countingSundays(1901, 2000), 171, 'message: countingSundays(1901, 2000) should return 171.');" ], - "solutions": [], + "solutions": ["function countingSundays(firstYear, lastYear) {\n let sundays = 0;\n\n for (let year = firstYear; year <= lastYear; year++) {\n for (let month = 1; month <= 12; month++) {\n const thisDate = new Date(year, month, 1);\n if (thisDate.getDay() === 0) {\n sundays++;\n }\n }\n }\n return sundays;\n}"], "translations": {}, "challengeSeed": [ - "function euler19() {", + "function countingSundays(firstYear, lastYear) {", " // Good luck!", " return true;", "}", "", - "euler19();" + "countingSundays(1943, 1946);" ], "description": [ "You are given the following information, but you may prefer to do some research for yourself.",