diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.english.md index f86390f3ce..62158c419e 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
These define three classifications of positive integers based on their proper divisors. -Let $P(n)$ be the sum of the proper divisors of n where proper divisors are all positive integers n other than n itself. +Let $P(n)$ be the sum of the proper divisors of n where proper divisors are all positive integers n other than n itself. If P(n) < n then n is classed as deficient @@ -16,13 +16,13 @@ If P(n) === n then n is classed as perfectP(n) > n then n is classed as abundant Example: -6 has proper divisors of 1, 2, and 3. -1 + 2 + 3 = 6, so 6 is classed as a perfect number. +6 has proper divisors of 1, 2, and 3. +1 + 2 + 3 = 6, so 6 is classed as a perfect number.
## Instructions
-Implement a function that calculates how many of the integers from 1 to 20,000 (inclusive) are in each of the three classes. Output the result as an array in the following format [deficient, perfect, abundant]. +Implement a function that calculates how many of the integers from 1 to 20,000 (inclusive) are in each of the three classes. Output the result as an array in the following format [deficient, perfect, abundant].
## Tests diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/accumulator-factory.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/accumulator-factory.english.md index b731f5308f..d98e0f5c5c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/accumulator-factory.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/accumulator-factory.english.md @@ -12,9 +12,9 @@ A problem posed by Create a function that takes a number $n$ and generates accumulator functions that return the sum of every number ever passed to them. -Rules: +Rules: Do not use global variables. -Hint: +Hint: Closures save outer state. diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md index 77c9045b35..0b5371451b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/averages-root-mean-square.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
Compute the Root mean square of the numbers 1 through 10 inclusive. -The root mean square is also known by its initials RMS (or rms), and as the quadratic mean. +The root mean square is also known by its initials RMS (or rms), and as the quadratic mean. The RMS is calculated as the mean of the squares of the numbers, square-rooted: $$x_{\mathrm{rms}} = \sqrt {{{x_1}^2 + {x_2}^2 + \cdots + {x_n}^2} \over n}. $$
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md index 1575e58438..6c8d0b2d92 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/circles-of-given-radius-through-two-points.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
Given two points on a plane and a radius, usually two circles of given radius can be drawn through the points. -Exceptions: +Exceptions: where $h$ is the step size, the most relevant parameter for accuracy of the solution. A smaller step size increases accuracy but also the computation cost, so it has always has to be hand-picked according to the problem at hand. -Example: Newton's Cooling Law +Example: Newton's Cooling Law Newton's cooling law describes how an object of initial temperature $T(t_0) = T_0$ cools down in an environment of temperature $T_R$:
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factorial.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factorial.english.md index 5663224189..0228b59e1e 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factorial.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factorial.english.md @@ -13,11 +13,10 @@ Factorial of a number is given by: For example: -Note: -0! = 1 +Note: 0! = 1 ## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.english.md index ed5d361855..28653716a0 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/factors-of-a-mersenne-number.english.md @@ -6,17 +6,16 @@ challengeType: 5 ## Description
-A Mersenne number is a number in the form of 2P-1. -If P is prime, the Mersenne number may be a Mersenne prime -(if P is not prime, the Mersenne number is also not prime). +A Mersenne number is a number in the form of 2P-1. +If P is prime, the Mersenne number may be a Mersenne prime. (If P is not prime, the Mersenne number is also not prime.) In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, Lucas-Lehmer test. -There are very efficient algorithms for determining if a number divides 2P-1 (or equivalently, if 2P mod (the number) = 1). +There are very efficient algorithms for determining if a number divides 2P-1 (or equivalently, if 2P mod (the number) = 1). Some languages already have built-in implementations of this exponent-and-mod operation (called modPow or similar). The following is how to implement this modPow yourself: -For example, let's compute 223 mod 47. -Convert the exponent 23 to binary, you get 10111. Starting with square = 1, repeatedly square it. -Remove the top bit of the exponent, and if it's 1 multiply square by the base of the exponentiation (2), then compute square modulo 47. -Use the result of the modulo from the last step as the initial value of square in the next step: +For example, let's compute 223 mod 47. +Convert the exponent 23 to binary, you get 10111. Starting with square = 1, repeatedly square it. +Remove the top bit of the exponent, and if it's 1 multiply square by the base of the exponentiation (2), then compute square modulo 47. +Use the result of the modulo from the last step as the initial value of square in the next step:
 Remove   Optional
 square        top bit  multiply by 2  mod 47
@@ -27,18 +26,18 @@ square        top bit  multiply by 2  mod 47
 32*32 = 1024  1     1  1024*2 = 2048    27
 27*27 = 729   1        729*2 = 1458      1
 
-Since 223 mod 47 = 1, 47 is a factor of 2P-1. -(To see this, subtract 1 from both sides: 223-1 = 0 mod 47.) -Since we've shown that 47 is a factor, 223-1 is not prime. +Since 223 mod 47 = 1, 47 is a factor of 2P-1. +(To see this, subtract 1 from both sides: 223-1 = 0 mod 47.) +Since we've shown that 47 is a factor, 223-1 is not prime. Further properties of Mersenne numbers allow us to refine the process even more. -Any factor q of 2P-1 must be of the form 2kP+1, k being a positive integer or zero. Furthermore, q must be 1 or 7 mod 8. -Finally any potential factor q must be prime. -As in other trial division algorithms, the algorithm stops when 2kP+1 > sqrt(N).These primality tests only work on Mersenne numbers where P is prime. For example, M4=15 yields no factors using these techniques, but factors into 3 and 5, neither of which fit 2kP+1. +Any factor q of 2P-1 must be of the form 2kP+1, k being a positive integer or zero. Furthermore, q must be 1 or 7 mod 8. +Finally any potential factor q must be prime. +As in other trial division algorithms, the algorithm stops when 2kP+1 > sqrt(N).These primarily tests only work on Mersenne numbers where P is prime. For example, M4=15 yields no factors using these techniques, but factors into 3 and 5, neither of which fit 2kP+1.
## Instructions
-Using the above method find a factor of 2929-1 (aka M929) +Using the above method find a factor of 2929-1 (aka M929)
## Tests diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/farey-sequence.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/farey-sequence.english.md index 08d6cbf7c6..22b56c35c5 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/farey-sequence.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/farey-sequence.english.md @@ -6,14 +6,14 @@ challengeType: 5 ## Description
-The Farey sequence Fn of order n is the sequence of completely reduced fractions between 0 and 1 which, when in lowest terms, have denominators less than or equal to n, arranged in order of increasing size. +The Farey sequence Fn of order n is the sequence of completely reduced fractions between 0 and 1 which, when in lowest terms, have denominators less than or equal to n, arranged in order of increasing size. The Farey sequence is sometimes incorrectly called a Farey series. Each Farey sequence: -The Farey sequences of orders 1 to 5 are: +The Farey sequences of orders 1 to 5 are:
## Tests diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-sequence.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-sequence.english.md index 847a3d2879..a781e15c7c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-sequence.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-sequence.english.md @@ -6,10 +6,10 @@ challengeType: 5 ## Description
-Write a function to generate the nth Fibonacci number. -The nth Fibonacci number is given by: -Fn = Fn-1 + Fn-2 -The first two terms of the series are 0, 1. +Write a function to generate the nth Fibonacci number. +The nth Fibonacci number is given by: +Fn = Fn-1 + Fn-2 +The first two terms of the series are 0 and 1. Hence, the series is: 0, 1, 1, 2, 3, 5, 8, 13...
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-word.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-word.english.md index 7f42d0b9a1..24429b9285 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-word.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/fibonacci-word.english.md @@ -8,16 +8,16 @@ challengeType: 5
The Fibonacci Word may be created in a manner analogous to the Fibonacci Sequence as described here:
-Define  F_Word1  as  1
-Define  F_Word2  as  0
-Form   F_Word3  as  F_Word2   concatenated with  F_Word1   i.e.:  01
+Define  F_Word1  as  1
+Define  F_Word2  as  0
+Form   F_Word3  as  F_Word2   concatenated with  F_Word1   i.e.:  01
 Form   F_Wordn  as  F_Wordn-1  concatenated with  F_wordn-2
 
## Instructions
-Write a function to return the Fibonacci Words upto N. N will be provided as a parameter to the function. The function should return an array of objects. The objects should be of the form: { N: 1, Length: 1, Entropy: 0, Word: '1' }. +Write a function to return the Fibonacci Words up to n. n will be provided as a parameter to the function. The function should return an array of objects. The objects should be of the form: { N: 1, Length: 1, Entropy: 0, Word: '1' }.
## Tests @@ -26,11 +26,11 @@ Write a function to return the Fibonacci Words upto N. N will be p ```yml tests: - text: fibWord is a function. - testString: assert(typeof fibWord === 'function', 'fibWord is a function.'); + testString: assert(typeof fibWord === 'function'); - text: fibWord(5) should return an array. - testString: assert(Array.isArray(fibWord(5)),'fibWord(5) should return an array.'); - - text: fibWord(5) should return '+JSON.stringify(ans)+'. - testString: assert.deepEqual(fibWord(5),ans,'fibWord(5) should return '+JSON.stringify(ans)+'.'); + testString: assert(Array.isArray(fibWord(5))); + - text: fibWord(5) should return [{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.9182958340544896, Word:"010" },{ N:5, Length:5, Entropy:0.9709505944546688, Word:"01001" }]. + testString: assert.deepEqual(fibWord(5),ans); ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hailstone-sequence.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hailstone-sequence.english.md index 42bbc524e0..b987b4f312 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hailstone-sequence.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hailstone-sequence.english.md @@ -6,11 +6,11 @@ challengeType: 5 ## Description
-The Hailstone sequence of numbers can be generated from a starting positive integer, n by: +The Hailstone sequence of numbers can be generated from a starting positive integer, n by: The (unproven) Collatz conjecture is that the hailstone sequence for any starting number always terminates. The hailstone sequence is also known as hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as the Collatz sequence. @@ -19,11 +19,11 @@ The hailstone sequence is also known as hailstone numbers (because the values ar ## Instructions
    -
  1. Create a routine to generate the hailstone sequence for a number.
  2. +
  3. Create a routine to generate the hailstone sequence for a number
  4. Use the routine to show that the hailstone sequence for the number 27 has 112 elements starting with 27, 82, 41, 124 and ending with 8, 4, 2, 1
  5. Show the number less than 100,000 which has the longest hailstone sequence together with that sequence's length. (But don't show the actual sequence!)
-See also: +See also: diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/happy-numbers.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/happy-numbers.english.md index 616e9931e8..25a3c98df2 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/happy-numbers.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/happy-numbers.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
A happy number is defined by the following process: -Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. +Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers.
## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/harshad-or-niven-series.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/harshad-or-niven-series.english.md index 0b1c32a86d..40adc0dad9 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/harshad-or-niven-series.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/harshad-or-niven-series.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. -For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder. +For example, 42 is a Harshad number as 42 is divisible by (4 + 2) without remainder. Assume that the series is defined as the numbers in increasing order.
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-from-two-arrays.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-from-two-arrays.english.md index 675196b159..fb4c976d0c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-from-two-arrays.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-from-two-arrays.english.md @@ -7,7 +7,7 @@ challengeType: 5 ## Description
Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values). -Related task: +Related task: diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-join.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-join.english.md index 989b01105a..bb24ea02be 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-join.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hash-join.english.md @@ -9,34 +9,34 @@ challengeType: 5 An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. The "hash join" algorithm consists of two steps:
    -
  1. Hash phase: Create a multimap from one of the two tables, mapping from each join column value to all the rows that contain it.
  2. +
  3. Hash phase: Create a multimap from one of the two tables, mapping from each join column value to all the rows that contain it.
    • The multimap must support hash-based lookup which scales better than a simple linear search, because that's the whole point of this algorithm.
    • Ideally we should create the multimap for the smaller table, thus minimizing its creation time and memory size.
    -
  4. Join phase: Scan the other table, and find matching rows by looking in the multimap created before.
  5. +
  6. Join phase: Scan the other table, and find matching rows by looking in the multimap created before.
In pseudo-code, the algorithm could be expressed as follows:
-let A = the first input table (or ideally, the larger one)
-let B = the second input table (or ideally, the smaller one)
-let jA = the join column ID of table A
-let jB = the join column ID of table B
-let MB = a multimap for mapping from single values to multiple rows of table B (starts out empty)
-let C = the output table (starts out empty)
-for each row b in table B:
-  place b in multimap MB under key b(jB)
-for each row a in table A:
-  for each row b in multimap MB under key a(jA):
-    let c = the concatenation of row a and row b
-    place row c in table C
+let A = the first input table (or ideally, the larger one)
+let B = the second input table (or ideally, the smaller one)
+let jA = the join column ID of table A
+let jB = the join column ID of table B
+let MB = a multimap for mapping from single values to multiple rows of table B (starts out empty)
+let C = the output table (starts out empty)
+for each row b in table B:
+  place b in multimap MB under key b(jB)
+for each row a in table A:
+  for each row b in multimap MB under key a(jA):
+    let c = the concatenation of row a and row b
+    place row c in table C
 
## Instructions
Implement the "hash join" algorithm as a function and demonstrate that it passes the test-case listed below. The function should accept two arrays of objects and return an array of combined objects. -

Input

+

Input

@@ -114,7 +114,7 @@ Implement the "hash join" algorithm as a function and demonstrate that it passes
-

Output

+

Output

diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/heronian-triangles.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/heronian-triangles.english.md index 7b8bd6e2b8..c0fc662a6d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/heronian-triangles.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/heronian-triangles.english.md @@ -11,11 +11,11 @@ challengeType: 5 where s is half the perimeter of the triangle; that is, $s=\frac{a+b+c}{2}.$ Heronian triangles are triangles whose sides and area are all integers. -An example is the triangle with sides 3, 4, 5 whose area is 6 (and whose perimeter is 12). -Note that any triangle whose sides are all an integer multiple of 3, 4, 5; such as 6, 8, 10, will also be a Heronian triangle. +An example is the triangle with sides 3, 4, 5 whose area is 6 (and whose perimeter is 12). +Note that any triangle whose sides are all an integer multiple of 3, 4, 5; such as 6, 8, 10, will also be a Heronian triangle. Define a Primitive Heronian triangle as a Heronian triangle where the greatest common divisor -of all three sides is 1 (unity). -This will exclude, for example, triangle 6, 8, 10. +of all three sides is 1 (unity). +This will exclude, for example, triangle 6, 8, 10. ## Instructions diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.english.md index d65cce5621..3474fe0a87 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/hofstadter-figure-figure-sequences.english.md @@ -17,9 +17,9 @@ Sequence $S$ starts: ## Instructions
-Create two functions named ffr and ffs that when given n return R(n) or S(n) respectively. (Note that R(1) = 1 and S(1) = 2 to avoid off-by-one errors). -No maximum value for n should be assumed. -References +Create two functions named ffr and ffs that when given n return R(n) or S(n) respectively. (Note that R(1) = 1 and S(1) = 2 to avoid off-by-one errors). +No maximum value for n should be assumed. +References
  • Sloane's A005228 and A030124. diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/identity-matrix.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/identity-matrix.english.md index c5df19bf07..0fb7e697cf 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/identity-matrix.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/identity-matrix.english.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
    -An identity matrix is a square matrix of size \( n \times n \), where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). +An identity matrix is a square matrix of size \( n \times n \), where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes).
    • \(\displaystyle I_{n}=\begin{bmatrix} 1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & 1 \cr \end{bmatrix}\)
    diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/jaro-distance.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/jaro-distance.english.md index 8416d8d697..6abd8d8f1d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/jaro-distance.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/jaro-distance.english.md @@ -6,8 +6,8 @@ challengeType: 5 ## Description
    -The Jaro distance is a measure of similarity between two strings. The higher the Jaro distance for two strings is, the more similar the strings are. The score is normalized such that 0 equates to no similarity and 1 is an exact match. -Definition +The Jaro distance is a measure of similarity between two strings. The higher the Jaro distance for two strings is, the more similar the strings are. The score is normalized such that 0 equates to no similarity and 1 is an exact match. +Definition The Jaro distance \( d_j \) of two given strings \(s_1\) and \(s_2\) is \begin{align}d_j = \begin{cases}0& & \text{if }m=0 \\\\{\frac {1}{3}}\left({\frac {m}{|s_{1}|}}+{\frac {m}{|s_{2}|}}+{\frac {m-t}{m}}\right)& & \text{otherwise}\end{cases}\end{align} Where: @@ -17,7 +17,7 @@ Where:
Two characters from \(s_1\) and \(s_2\) respectively, are considered matching only if they are the same and not farther than \(\left\lfloor\frac{\max(|s_1|,|s_2|)}{2}\right\rfloor-1\). Each character of \(s_1\) is compared with all its matching characters in \(s_2\) . The number of matching (but different sequence order) characters divided by 2 defines the number of transpositions. -Example +Example Given the strings \(s_1\) DWAYNE and \(s_2\) DUANE we find:
  • \(m = 4\)
  • 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 a5b7cebda0..205b241cb1 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 @@ -16,14 +16,14 @@ The function should read a single but nested S-Expression from a string and retu 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)" may be 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. +For this, the reader need not recognize "\" for escaping, but should, in addition, recognize numbers if the language has appropriate data types. 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.) +and turn it into a native data structure. (See the Pike, Python and Ruby implementations for examples of native data structures.)
## Tests diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.english.md index 5331675176..ed41352ae4 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sailors-coconuts-and-a-monkey-problem.english.md @@ -15,9 +15,9 @@ In the morning (after the surreptitious and separate action of each of the five ## Instructions
Create a function that returns the minimum possible size of the initial pile of coconuts collected during the day for N sailors. -Note: +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: +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).
  • 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 c9237b3fea..9a4ed0cb28 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 @@ -7,7 +7,7 @@ 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: +The first taxicab number is 1729, which is: 13   +   123       and 93   +   103. Taxicab numbers are also known as: @@ -22,7 +22,7 @@ Taxicab numbers are also known as: ## 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: +See also:
    • A001235 taxicab numbers on The On-Line Encyclopedia of Integer Sequences.
    • taxicab number on Wikipedia.
    • 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 fc26f276c8..e3adea23c8 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 @@ -9,9 +9,9 @@ challengeType: 5 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
      • +
      • The string
      • +
      • The separator character
      • +
      • The escape character
      It should output a list of strings. Rules for splitting: 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 dd16cb02bf..bf4e5f8b15 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 @@ -38,7 +38,7 @@ 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.: +C.f.: diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/word-wrap.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/word-wrap.english.md index ef61abd3ab..b840fa1ecd 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/word-wrap.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/word-wrap.english.md @@ -16,7 +16,7 @@ Write a function that can wrap this text to any number of characters. As an exam Wrap text using a more sophisticated algorithm such as the Knuth and Plass TeX algorithm. If your language provides this, you get easy extra credit, but you must reference documentation indicating that the algorithm is something better -than a simple minimimum length algorithm. +than a simple minimum length algorithm.
    diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/y-combinator.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/y-combinator.english.md index 9b44171e6b..c63bbb01ed 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/y-combinator.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/y-combinator.english.md @@ -13,7 +13,7 @@ The Y combin ## Instructions
    Define the stateless Y combinator function and use it to compute factorial. The factorial(N) function is already given to you. -See also: +See also: diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.english.md index 4645cefec6..70a4525f77 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/zhang-suen-thinning-algorithm.english.md @@ -52,7 +52,7 @@ The algorithm operates on all black pixels P1 that can have eight neighbours. Th
A_age
- +
P9P2P3
P8P1P4
P8P1P4
P7P6P5
@@ -68,8 +68,8 @@ All pixels are tested and pixels satisfying all the following conditions (simult
  • The pixel is black and has eight neighbours
  • $2 <= B(P1) <= 6$
  • $A(P1) = 1$
  • -
  • At least one of P2, P4 and P6 is white
  • -
  • At least one of P4, P6 and P8 is white
  • +
  • At least one of P2, P4 and P6 is white
  • +
  • At least one of P4, P6 and P8 is white
  • After iterating over the image and collecting all the pixels satisfying all step 1 conditions, all these condition satisfying pixels are set to white. @@ -79,8 +79,8 @@ All pixels are again tested and pixels satisfying all the following conditions a
  • The pixel is black and has eight neighbours
  • $2 <= B(P1) <= 6$
  • $A(P1) = 1$
  • -
  • At least one of P2, P4 and P8 is white
  • -
  • At least one of P2, P6 and P8 is white
  • +
  • At least one of P2, P4 and P8 is white
  • +
  • At least one of P2, P6 and P8 is white
  • After iterating over the image and collecting all the pixels satisfying all step 2 conditions, all these condition satisfying pixels are again set to white.

    Iteration: