diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/s-expressions.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/s-expressions.english.md
index f8cca3d3ac..7c2d40306d 100644
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/s-expressions.english.md
+++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/s-expressions.english.md
@@ -6,50 +6,24 @@ challengeType: 5
## Description
-S-Expressions are one convenient way to parse and store data.
-
- Write a simple reader/parser for S-Expressions that handles quoted and unquoted strings, integers and floats.
-
-The function should read a single but nested S-Expression from a string and
-return it as a (nested) array.
-
- Newlines and other whitespace may be ignored unless contained within a quoted string.
- “()” inside quoted strings are not interpreted, but treated as part of the string.
-
-Handling escaped quotes inside a string is optional; thus “(foo"bar)” maybe treated as a string “foo"bar”, or as an error.
-
-For this, the reader need not recognize “\” for escaping, but should, in addition, recognize numbers if the language has appropriate datatypes.
-
-Note that with the exception of “()"” (“\” if escaping is supported) and whitespace there are no special characters. Anything else is allowed without quotes.
- The reader should be able to read the following input
-
- ((data "quoted data" 123 4.5)
- (data (!@# (4.5) "(more" "data)")))
-
-
-and turn it into a native datastructure. (see the -Pike, -Python and -Ruby implementations -for examples of native data structures.) -
+S-Expressions are one convenient way to parse and store data. ## Instructions+((data "quoted data" 123 4.5) +(data (!@# (4.5) "(more" "data)"))) ++and turn it into a native datastructure. (see the Pike, Python and Ruby implementations for examples of native data structures.)
- Five sailors are shipwrecked on an island and - collect a large pile of coconuts during the day. -
-That night the first sailor wakes up and decides - to take his first share early so tries to divide the pile of coconuts equally - into five piles but finds that there is one coconut left over, so he tosses it - to a monkey and then hides "his" one of the five equally sized piles of - coconuts and pushes the other four piles together to form a single visible pile - of coconuts again and goes to bed. -
-- To cut a long story short, each of the sailors in - turn gets up once during the night and performs the same actions of dividing - the coconut pile into five, finding that one coconut is left over and giving - that single remainder coconut to the monkey. -
-- In the morning (after the surreptitious and - separate action of each of the five sailors during the night), the remaining - coconuts are divided into five equal piles for each of the sailors, whereupon - it is found that the pile of coconuts divides equally amongst the sailors with - no remainder. (Nothing for the monkey in the morning.) -
- - The task: - - - Create a function that returns the - the minimum possible size - of the initial pile of coconuts collected during the day for N - sailors. - - - Note: - - - Of course the tale is told in a - world where the collection of any amount of coconuts in a day and multiple - divisions of the pile, etc can occur in time fitting the story line, so as - not to affect the mathematics. - - - - C.f: - - - Monkeys and Coconuts - Numberphile (Video) Analytical solution. - - - A002021 Pile of coconuts problem The On-Line - Encyclopedia of Integer Sequences. (Although some of its references may use - the alternate form of the tale). - - - +Five sailors are shipwrecked on an island and collect a large pile of coconuts during the day. +That night the first sailor wakes up and decides to take his first share early so tries to divide the pile of coconuts equally into five piles but finds that there is one coconut left over, so he tosses it to a monkey and then hides "his" one of the five equally sized piles of coconuts and pushes the other four piles together to form a single visible pile of coconuts again and goes to bed. +To cut a long story short, each of the sailors in turn gets up once during the night and performs the same actions of dividing the coconut pile into five, finding that one coconut is left over and giving that single remainder coconut to the monkey. +In the morning (after the surreptitious and separate action of each of the five sailors during the night), the remaining coconuts are divided into five equal piles for each of the sailors, whereupon it is found that the pile of coconuts divides equally amongst the sailors with no remainder. (Nothing for the monkey in the morning.)N
sailors.
+Note:
+Of course the tale is told in a world where the collection of any amount of coconuts in a day and multiple divisions of the pile, etc. can occur in time fitting the story line, so as not to affect the mathematics.
+C.f:
+- For each number list of 6-digit - SEDOLs, - calculate and append the checksum digit. -
- -- That is, given the input string on the left, your function should return the - corresponding string on the right: -
- -- 710889 => 7108899 - B0YBKJ => B0YBKJ7 - 406566 => 4065663 - B0YBLH => B0YBLH2 - 228276 => 2282765 - B0YBKL => B0YBKL9 - 557910 => 5579107 - B0YBKR => B0YBKR5 - 585284 => 5852842 - B0YBKT => B0YBKT7 - B00030 => B000300 -- -
- Check also that each input is correctly formed, especially
- with respect to valid characters allowed in a SEDOL string. Your function
- should return null
on invalid input.
-
+710889 => 7108899 +B0YBKJ => B0YBKJ7 +406566 => 4065663 +B0YBLH => B0YBLH2 +228276 => 2282765 +B0YBKL => B0YBKL9 +557910 => 5579107 +B0YBKR => B0YBKR5 +585284 => 5852842 +B0YBKT => B0YBKT7 +B00030 => B000300 ++Check that each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string. Your function should return
null
on an invalid input.
UK London +Similarly, stable sorting on just the first column would generate “UK London” as the first item and “US Birmingham” as the last item (since the order of the elements having the same first word – “UK” or “US” – would be maintained). -Write a function that takes a 2D array as a parameter. Each element has 2 elements similar to the above example. The function should sort the array as mentioned previously and return the sorted array.+UK London US New York US Birmingham -UK Birmingham+UK Birmingham +
stableSort
should be a function.
testString: assert(typeof stableSort == 'function', 'stableSort
should be a function.');
- - text: stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return a array.
- testString: assert(Array.isArray(stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])), 'stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return a array.');
+ - text: stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return an array.
+ testString: assert(Array.isArray(stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])), 'stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return an array.');
- text: stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return [["US", "Birmingham"], ["UK", "Birmingham"], ["UK", "London"], ["US", "New York"]]
.
testString: assert.deepEqual(stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]]), [["US", "Birmingham"], ["UK", "Birmingham"], ["UK", "London"], ["US", "New York"]], 'stableSort([["UK", "London"], ["US", "New York"], ["US", "Birmingham"], ["UK", "Birmingham"]])
should return [["US", "Birmingham"], ["UK", "Birmingham"], ["UK", "London"], ["US", "New York"]]
.');
- text: stableSort([[2, 2], [1, 2], [1, 4], [1, 5]])
should return [[2, 2], [1, 2], [1, 4], [1, 5]]
.
@@ -48,7 +50,7 @@ tests: