From f8061bcb5600af60db15298cba2da7ee2979b044 Mon Sep 17 00:00:00 2001 From: The Coding Aviator <34807532+thecodingaviator@users.noreply.github.com> Date: Sun, 24 Feb 2019 20:09:41 +0530 Subject: [PATCH] Fixed formatting of the 24 Game | Rosetta challenge --- .../rosetta-code/24-game.english.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/24-game.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/24-game.english.md index 41ddf0bfcd..32966fba58 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/24-game.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/24-game.english.md @@ -6,22 +6,22 @@ challengeType: 5 ## Description
-

Implement a function that takes a string of four digits as its argument, with each digit from 1 ──► 9 (inclusive) with repetitions allowed, and returns an arithmetic expression that evaluates to the number 24. If no such solution exists, return "no solution exists."

-

Rules:

- Only the following operators/functions are allowed: multiplication, division, addition, subtraction - Division should use floating point or rational arithmetic, etc, to preserve remainders. - Forming multiple digit numbers from the supplied digits is disallowed. (So an answer of 12+12 when given 1, 2, 2, and 1 is wrong). - The order of the digits when given does not have to be preserved. -

Example inputs:

-solve24("4878"); -solve24("1234"); -solve24("6789"); -solve24("1127"); -

Example outputs (strings):

-(7-8/8)*4 -3*1*4*2 -(6*8)/(9-7) -(1+7)*(2+1) +

Implement a function that takes a string of four digits as its argument, with each digit from 1 to 9 (inclusive) with repetitions allowed, and returns an arithmetic expression that evaluates to the number 24. If no such solution exists, return "no solution exists."

+ + ### Rules: + + +| Example input | Example output | +| --- | --- | +| solve24("4878"); | (7-8/8)*4 | +| solve24("1234"); | 3*1*4*2 | +| solve24("6789"); | (6*8)/(9-7) | +| solve24("1127"); | (1+7)*(2+1) |
## Instructions @@ -55,7 +55,7 @@ tests:
```js -function solve24 (numStr) { +function solve24 (numStr){ // Good luck! return true; } @@ -99,7 +99,7 @@ function include(ansArr, res) { ```js // noprotect -function solve24 (numStr) { +function solve24 (numStr){ const digitsArr = numStr.split(''); const answers = [];