diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/taxicab-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/taxicab-numbers.english.md index 2ae1f5014b..bbe08be270 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/taxicab-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/taxicab-numbers.english.md @@ -6,29 +6,29 @@ challengeType: 5 ## Description
-A   taxicab number -  (the definition that is being used here)   is a positive integer that can be expressed as the sum of two positive cubes in more than one way. -The first taxicab number is   1729,   which is: -13   +   123       and -93   +   103. +A   taxicab number (the definition that is being used here) is a positive integer that can be expressed as the sum of two positive cubes in more than one way. +The first taxicab number is 1729, which is: +13   +   123       and +93   +   103. Taxicab numbers are also known as: - *   taxi numbers - *   taxi-cab numbers - *   taxi cab numbers - *   Hardy-Ramanujan numbers -Task: -Write a function that returns the lowest N taxicab numbers. -For each of the taxicab numbers, show the number as well as it's constituent cubes. -See also: -[http://oeis.org/A001235 A001235 taxicab numbers] on The On-Line Encyclopedia of Integer Sequences. - Hardy-Ramanujan Number on MathWorld. - taxicab number on MathWorld. - taxicab number on Wikipedia. +
## Instructions
- +Write a function that returns the lowest n taxicab numbers. For each of the taxicab numbers, show the number as well as its constituent cubes. +See also: +
## Tests @@ -36,18 +36,18 @@ See also: ```yml tests: - - text: taxicabNumbers is a function. - testString: assert(typeof taxicabNumbers === 'function', 'taxicabNumbers is a function.'); - - text: taxicabNumbers should return an array. - testString: assert(typeof taxicabNumbers(2) === 'object', 'taxicabNumbers should return an array.'); - - text: taxicabNumbers should return an array of numbers. - testString: assert(typeof taxicabNumbers(100)[0] === 'number', 'taxicabNumbers should return an array of numbers.'); - - text: taxicabNumbers(4) must return [1729, 4104, 13832, 20683]. - testString: assert.deepEqual(taxicabNumbers(4), res4, 'taxicabNumbers(4) must return [1729, 4104, 13832, 20683].'); - - text: taxicabNumbers(25) should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597] - testString: assert.deepEqual(taxicabNumbers(25), res25, 'taxicabNumbers(25) should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597]'); - - text: taxicabNumbers(39) resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856]. - testString: assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29, 'taxicabNumbers(39) resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856].'); + - text: taxicabNumbers is a function. + testString: assert(typeof taxicabNumbers === 'function', 'taxicabNumbers is a function.'); + - text: taxicabNumbers should return an array. + testString: assert(typeof taxicabNumbers(2) === 'object', 'taxicabNumbers should return an array.'); + - text: taxicabNumbers should return an array of numbers. + testString: assert(typeof taxicabNumbers(100)[0] === 'number', 'taxicabNumbers should return an array of numbers.'); + - text: taxicabNumbers(4) must return [1729, 4104, 13832, 20683]. + testString: assert.deepEqual(taxicabNumbers(4), res4, 'taxicabNumbers(4) must return [1729, 4104, 13832, 20683].'); + - text: taxicabNumbers(25) should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597] + testString: assert.deepEqual(taxicabNumbers(25), res25, 'taxicabNumbers(25) should return [1729, 4104, 13832, 20683, 32832, 39312, 40033, 46683, 64232, 65728, 110656, 110808, 134379, 149389, 165464, 171288, 195841, 216027, 216125, 262656, 314496, 320264, 327763, 373464, 402597]'); + - text: taxicabNumbers(39) resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856]. + testString: assert.deepEqual(taxicabNumbers(39).slice(20, 29), res39From20To29, 'taxicabNumbers(39) resulting numbers from 20 - 29 should be [314496,320264,327763,373464,402597,439101,443889,513000,513856].'); ``` @@ -59,7 +59,7 @@ tests:
```js -function taxicabNumbers (n) { +function taxicabNumbers(n) { // Good luck! return true; } diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.english.md index 84d32d1d1d..fc26f276c8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/tokenize-a-string-with-escaping.english.md @@ -6,31 +6,32 @@ challengeType: 5 ## Description
-

Write a function or program that can split a string at each non-escaped occurrence of a separator character. -

-

It should accept three input parameters: -

- The string - The separator character - The escape character -

It should output a list of strings.

-

Rules for splitting:

- The fields that were separated by the separators, become the elements of the output list. - Empty fields should be preserved, even at the start and end. -

Rules for escaping:

- "Escaped" means preceded by an occurrence of the escape character that is not already escaped itself. - When the escape character precedes a character that has no special meaning, it still counts as an escape (but does not do anything special). - Each occurrences of the escape character that was used to escape something, should not become part of the output. -

Demonstrate that your function satisfies the following test-case: - Given string

one^|uno||three^^^^|four^^^|^cuatro|
and using -
|
as a separator and
^
as escape character, your - function should output the following array: -

-
-  ['one|uno', '', 'three^^', 'four^|quatro', '']
-  
+ +It should output a list of strings. +Rules for splitting: + +Rules for escaping: + +Demonstrate that your function satisfies the following test-case: +Given the string +
one^|uno||three^^^^|four^^^|^cuatro|
+and using | as a separator and ^ as escape character, your function should output the following array: +
+  ['one|uno', '', 'three^^', 'four^|cuatro', '']
+
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/top-rank-per-group.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/top-rank-per-group.english.md index e222370937..1f2f84c31c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/top-rank-per-group.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/top-rank-per-group.english.md @@ -6,8 +6,7 @@ challengeType: 5 ## Description
-Task: -

Find the top N ranked data in each group, where N is provided as a parameter. Name of the rank and the group are also provided as parameter.

+Find the top n ranked data in each group, where n is provided as a parameter. Name of the rank and the group are also provided as parameter. Given the following data:
 [
@@ -119,7 +118,6 @@ const testData2 = [
 const res2 = topRankPerGroup(1, testData2, 'genre', 'rating');
 const res3 = topRankPerGroup(2, testData2, 'genre', 'rating');
 
-//console.log(JSON.stringify(topRankPerGroup(10, testData1)));
 ```
 
 
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/topological-sort.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/topological-sort.english.md index f98b5814f8..c1d02407e1 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/topological-sort.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/topological-sort.english.md @@ -6,25 +6,20 @@ challengeType: 5 ## Description
-

-Given a mapping between items, and items they depend on, a -topological sort orders -items so that no item precedes an item it depends upon. -

-

-The compiling of a library in the -VHDL language -has the constraint that a library must be compiled after any library it depends on. -

-Task: -

+Given a mapping between items, and items they depend on, a topological sort orders items so that no item precedes an item it depends upon. +The compiling of a library in the VHDL language has the constraint that a library must be compiled after any library it depends on. +

+ +## Instructions +
Write a function that will return a valid compile order of VHDL libraries from their dependencies. -

- Assume library names are single words. - Items mentioned as only dependents have no dependents of their own, but their order of compiling must be given. - Any self dependencies should be ignored. - Any un-orderable dependencies should be ignored. -

Use the following data as an example:

+ +Use the following data as an example:
 LIBRARY          LIBRARY DEPENDENCIES
 =======          ====================
@@ -42,29 +37,16 @@ ramlib           std ieee
 std_cell_lib     ieee std_cell_lib
 synopsys
 
-

Note: the above data would be un-orderable if, for example, dw04 is added to the list of dependencies of dw01. -

-C.f.: - - Topological sort/Extracted top item. - -

There are two popular algorithms for topological sorting:

-

- Kahn's 1962 topological sort, and depth-first search: - topological sort -

-

- Jason Sachs: - - "Ten little algorithms, part 4: topological sort" - . -

-
- -## Instructions -
- +C.f.: + +There are two popular algorithms for topological sorting: +
## Tests diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/towers-of-hanoi.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/towers-of-hanoi.english.md index 6ab9a824d6..cec6edc640 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/towers-of-hanoi.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/towers-of-hanoi.english.md @@ -6,16 +6,9 @@ challengeType: 5 ## Description
- Task: -

Solve the Towers of Hanoi problem.

-

-Your solution should accept the number of discs as the first parameters, and -three string used to identify each of the three stacks of discs, for example -towerOfHanoi(4, 'A', 'B', 'C'). The function should return an -array of arrays containing the list of moves, source -> destination. For -example, the array [['A', 'C'], ['B', 'A']] indicates that the -1st move was to move a disc from stack A to C, and the 2nd move was to move a -disc from stack B to A. +Solve the Towers of Hanoi problem.

+Your solution should accept the number of discs as the first parameters, and three string used to identify each of the three stacks of discs, for example towerOfHanoi(4, 'A', 'B', 'C'). The function should return an array of arrays containing the list of moves, source -> destination. +For example, the array [['A', 'C'], ['B', 'A']] indicates that the 1st move was to move a disc from stack A to C, and the 2nd move was to move a disc from stack B to A.

@@ -50,7 +43,7 @@ tests:
```js -function towerOfHanoi (n, a, b, c) { +function towerOfHanoi(n, a, b, c) { // Good luck! return [[]]; }