From 3d1ef747e230a5588e667616c8340b81f8127ae5 Mon Sep 17 00:00:00 2001 From: Alvin Kristanto Date: Sat, 12 Aug 2017 02:17:25 +0700 Subject: [PATCH] edited project euler problem 20 (#15748) revert(challenges): Change function name, parameters given, and return Give better naming, avoid infiinite loop --- .../project-euler-problems.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/seed/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json b/seed/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json index 2366ef8544..244b83e2d2 100644 --- a/seed/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json +++ b/seed/challenges/08-coding-interview-questions-and-take-home-assignments/project-euler-problems.json @@ -637,22 +637,26 @@ "type": "bonfire", "title": "Problem 20: Factorial digit sum", "tests": [ - "assert.strictEqual(euler20(), 648, 'message: \u003ccode\u003eeuler20()\u003c/code\u003e should return 648.');" + "assert.strictEqual(sumFactorialDigits(10), 27, 'message: \u003ccode\u003esumFactorialDigits(10)\u003c/code\u003e should return 27.');", + "assert.strictEqual(sumFactorialDigits(25), 72, 'message: \u003ccode\u003esumFactorialDigits(25)\u003c/code\u003e should return 72.');", + "assert.strictEqual(sumFactorialDigits(50), 216, 'message: \u003ccode\u003esumFactorialDigits(50)\u003c/code\u003e should return 216.');", + "assert.strictEqual(sumFactorialDigits(75), 432, 'message: \u003ccode\u003esumFactorialDigits(75)\u003c/code\u003e should return 432.');", + "assert.strictEqual(sumFactorialDigits(100), 648, 'message: \u003ccode\u003esumFactorialDigits(100)\u003c/code\u003e should return 648.');" ], "solutions": [], "translations": {}, "challengeSeed": [ - "function euler20() {", + "function sumFactorialDigits(n) {", " // Good luck!", - " return true;", + " return n;", "}", "", - "euler20();" + "sumFactorialDigits(100);" ], "description": [ "n! means n × (n − 1) × ... × 3 × 2 × 1", "For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.", - "Find the sum of the digits in the number 100!" + "Find the sum of the digits n!" ] }, {