diff --git a/curriculum/challenges/english/blocks/rosetta-code-challenges/5958469238c0d8d2632f46db.md b/curriculum/challenges/english/blocks/rosetta-code-challenges/5958469238c0d8d2632f46db.md index 39498bf8ed9..3bc28ccd93c 100644 --- a/curriculum/challenges/english/blocks/rosetta-code-challenges/5958469238c0d8d2632f46db.md +++ b/curriculum/challenges/english/blocks/rosetta-code-challenges/5958469238c0d8d2632f46db.md @@ -26,6 +26,16 @@ Given non-negative integers `m` and `n`, generate all size `m` combinations of t 2 3 4 +# --before-each-- + +```js +const testInput1 = [3, 5]; +const testOutput1 = [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]; + +const testInput2 = [4, 6]; +const testOutput2 = [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 2, 5], [0, 1, 3, 4], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 4], [0, 2, 3, 5], [0, 2, 4, 5], [0, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]]; +``` + # --hints-- `combinations` should be a function. @@ -48,16 +58,6 @@ assert.deepEqual(combinations(testInput2[0], testInput2[1]), testOutput2); # --seed-- -## --after-user-code-- - -```js -const testInput1 = [3, 5]; -const testOutput1 = [[0, 1, 2], [0, 1, 3], [0, 1, 4], [0, 2, 3], [0, 2, 4], [0, 3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]; - -const testInput2 = [4, 6]; -const testOutput2 = [[0, 1, 2, 3], [0, 1, 2, 4], [0, 1, 2, 5], [0, 1, 3, 4], [0, 1, 3, 5], [0, 1, 4, 5], [0, 2, 3, 4], [0, 2, 3, 5], [0, 2, 4, 5], [0, 3, 4, 5], [1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 4, 5], [1, 3, 4, 5], [2, 3, 4, 5]]; -``` - ## --seed-contents-- ```js diff --git a/curriculum/challenges/english/blocks/rosetta-code-challenges/595b98f8b5a2245e243aa831.md b/curriculum/challenges/english/blocks/rosetta-code-challenges/595b98f8b5a2245e243aa831.md index 35c83855e3c..d1683ffb8d6 100644 --- a/curriculum/challenges/english/blocks/rosetta-code-challenges/595b98f8b5a2245e243aa831.md +++ b/curriculum/challenges/english/blocks/rosetta-code-challenges/595b98f8b5a2245e243aa831.md @@ -32,6 +32,19 @@ This will exclude, for example, triangle `6, 8, 10.` Implement a function based on Hero's formula that returns the first nth ordered triangles in an array of arrays. +# --before-each-- + +```js +const testCases = [10, 15, 20, 25]; + +const res = [ + [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]], + [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]], + [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]], + [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37], [16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]] +]; +``` + # --hints-- `heronianTriangle` should be a function. @@ -66,19 +79,6 @@ assert.deepEqual(heronianTriangle(testCases[3]), res[3]); # --seed-- -## --after-user-code-- - -```js -const testCases = [10, 15, 20, 25]; - -const res = [ - [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]], - [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]], - [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]], - [[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37], [16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]] -]; -``` - ## --seed-contents-- ```js diff --git a/curriculum/challenges/english/blocks/rosetta-code-challenges/59622f89e4e137560018a40e.md b/curriculum/challenges/english/blocks/rosetta-code-challenges/59622f89e4e137560018a40e.md index debc5f4db0a..4e7ef4e8d3d 100644 --- a/curriculum/challenges/english/blocks/rosetta-code-challenges/59622f89e4e137560018a40e.md +++ b/curriculum/challenges/english/blocks/rosetta-code-challenges/59622f89e4e137560018a40e.md @@ -33,6 +33,13 @@ No maximum value for `n` should be assumed.

Rosetta: Hofstadter Figure-Figure sequences

. +# --before-each-- + +```js +const ffrParamRes = [[10, 69], [50, 1509], [100, 5764], [1000, 526334]]; +const ffsParamRes = [[10, 14], [50, 59], [100, 112], [1000, 1041]]; +``` + # --hints-- `ffr` should be a function. @@ -109,13 +116,6 @@ assert.equal(ffs(ffsParamRes[3][0]), ffsParamRes[3][1]); # --seed-- -## --after-user-code-- - -```js -const ffrParamRes = [[10, 69], [50, 1509], [100, 5764], [1000, 526334]]; -const ffsParamRes = [[10, 14], [50, 59], [100, 112], [1000, 1041]]; -``` - ## --seed-contents-- ```js diff --git a/curriculum/challenges/english/blocks/rosetta-code-challenges/59637c4d89f6786115efd814.md b/curriculum/challenges/english/blocks/rosetta-code-challenges/59637c4d89f6786115efd814.md index 27c1bdb4dba..6a11c24e2e6 100644 --- a/curriculum/challenges/english/blocks/rosetta-code-challenges/59637c4d89f6786115efd814.md +++ b/curriculum/challenges/english/blocks/rosetta-code-challenges/59637c4d89f6786115efd814.md @@ -18,6 +18,13 @@ It is defined like the Fibonacci sequence, but whereas the next term in the Fibo Implement the Hofstadter Q Sequence equation as a function. The function should accept number, `n`, and return an integer. +# --before-each-- + +```js +const testCase = [1000, 1500, 2000, 2500]; +const res = [502, 755, 1005, 1261]; +``` + # --hints-- `hofstadterQ` should be a function. @@ -58,13 +65,6 @@ assert.equal(hofstadterQ(testCase[3]), res[3]); # --seed-- -## --after-user-code-- - -```js -const testCase = [1000, 1500, 2000, 2500]; -const res = [502, 755, 1005, 1261]; -``` - ## --seed-contents-- ```js diff --git a/curriculum/challenges/english/blocks/rosetta-code-challenges/59667989bf71cf555dd5d2ff.md b/curriculum/challenges/english/blocks/rosetta-code-challenges/59667989bf71cf555dd5d2ff.md index df583d4cb2a..a800332e5da 100644 --- a/curriculum/challenges/english/blocks/rosetta-code-challenges/59667989bf71cf555dd5d2ff.md +++ b/curriculum/challenges/english/blocks/rosetta-code-challenges/59667989bf71cf555dd5d2ff.md @@ -34,6 +34,16 @@ The reader should be able to read the following input and turn it into a native data structure. +# --before-each-- + +```js +const simpleSExpr = '(data1 data2 data3)'; +const simpleSolution = ['data1', 'data2', 'data3']; + +const basicSExpr = '((data "quoted data" 123 4.5) (data (!@# (4.5) "(more" "data)")))'; +const basicSolution = [["data","\"quoted data\"",123,4.5],["data",["!@#",[4.5],"\"(more\"","\"data)\""]]]; +``` + # --hints-- `parseSexpr` should be a function. @@ -56,16 +66,6 @@ assert.deepEqual(parseSexpr(basicSExpr), basicSolution); # --seed-- -## --after-user-code-- - -```js -const simpleSExpr = '(data1 data2 data3)'; -const simpleSolution = ['data1', 'data2', 'data3']; - -const basicSExpr = '((data "quoted data" 123 4.5) (data (!@# (4.5) "(more" "data)")))'; -const basicSolution = [["data","\"quoted data\"",123,4.5],["data",["!@#",[4.5],"\"(more\"","\"data)\""]]]; -``` - ## --seed-contents-- ```js