diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/i-before-e-except-after-c.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/i-before-e-except-after-c.english.md index 8fffe81204..418a292b8e 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/i-before-e-except-after-c.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/i-before-e-except-after-c.english.md @@ -6,16 +6,22 @@ challengeType: 5 ## Description
-The phrase "I before E, except after C" is a widely known mnemonic which is supposed to help when spelling English words. +The phrase "I before E, except after C" is a widely known mnemonic which is supposed to help when spelling English words. Using the words provided, check if the two sub-clauses of the phrase are plausible individually: -
  1. "I before E when not preceded by C".
  2. "E before I when preceded by C".
+
    +
  1. + "I before E when not preceded by C". +
  2. +
  3. + "E before I when preceded by C". +
  4. +
If both sub-phrases are plausible then the original phrase can be said to be plausible. -Write a function that accepts a word and check if the word follows this rule. The function should return true if it follows the rule otherwise false.
## Instructions
- +Write a function that accepts a word and check if the word follows this rule. The function should return true if the word follows the rule and false if it does not.
## Tests @@ -50,7 +56,7 @@ tests:
```js -function IBeforeExceptC (word) { +function IBeforeExceptC(word) { // Good luck! } ``` @@ -66,7 +72,7 @@ function IBeforeExceptC (word) { ```js -function IBeforeExceptC (word) +function IBeforeExceptC(word) { if(word.indexOf("c")==-1 && word.indexOf("ie")!=-1) return true; diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iban.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iban.english.md index 9c27c0629c..76c449f81c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iban.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iban.english.md @@ -6,20 +6,19 @@ challengeType: 5 ## Description
-The International Bank Account Number (IBAN) is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors. +The International Bank Account Number (IBAN) is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors. The IBAN consists of up to 34 alphanumeric characters: The check digits enable a sanity check of the bank account number to confirm its integrity even before submitting a transaction. -Write a function that takes IBAN string as parameter. If it is valid return true. Otherwise, return false.
## Instructions
- +Write a function that takes IBAN string as parameter. If it is valid return true. Otherwise, return false.
## Tests @@ -52,7 +51,7 @@ tests:
```js -function isValid (iban) { +function isValid(iban) { // Good luck! } ``` @@ -66,7 +65,7 @@ function isValid (iban) { ```js -function isValid (iban) { +function isValid(iban) { var ibanLen = { NO:15, BE:16, DK:18, FI:18, FO:18, GL:18, NL:18, MK:19, SI:19, AT:20, BA:20, EE:20, KZ:20, LT:20, LU:20, CR:21, 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 1f2b0bf2cd..c5df19bf07 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,16 +6,15 @@ 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). -\begin{bmatrix} 1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & 1 \cr \end{bmatrix} -Write a function that takes a number 'n' as a parameter and returns the identity matrix of order n x n. +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}\)
  • +
## Instructions
- +Write a function that takes a number n as a parameter and returns the identity matrix of order \( n \times n \).
## Tests @@ -27,14 +26,14 @@ tests: testString: assert(typeof idMatrix=='function','idMatrix should be a function.'); - text: idMatrix(1) should return an array. testString: assert(Array.isArray(idMatrix(1)),'idMatrix(1) should return an array.'); - - text: idMatrix(1) should return '+JSON.stringify(results[0])+'. - testString: assert.deepEqual(idMatrix(1),results[0],'idMatrix(1) should return '+JSON.stringify(results[0])+'.'); - - text: idMatrix(2) should return '+JSON.stringify(results[1])+'. - testString: assert.deepEqual(idMatrix(2),results[1],'idMatrix(2) should return '+JSON.stringify(results[1])+'.'); - - text: idMatrix(3) should return '+JSON.stringify(results[2])+'. - testString: assert.deepEqual(idMatrix(3),results[2],'idMatrix(3) should return '+JSON.stringify(results[2])+'.'); - - text: idMatrix(4) should return '+JSON.stringify(results[3])+'. - testString: assert.deepEqual(idMatrix(4),results[3],'idMatrix(4) should return '+JSON.stringify(results[3])+'.'); + - text: idMatrix(1) should return [ [ 1 ] ]. + testString: assert.deepEqual(idMatrix(1),results[0]); + - text: idMatrix(2) should return [ [ 1, 0 ], [ 0, 1 ] ]. + testString: assert.deepEqual(idMatrix(2),results[1]); + - text: idMatrix(3) should return [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]. + testString: assert.deepEqual(idMatrix(3),results[2]); + - text: idMatrix(4) should return [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]. + testString: assert.deepEqual(idMatrix(4),results[3]); ``` @@ -46,7 +45,7 @@ tests:
```js -function idMatrix (n) { +function idMatrix(n) { // Good luck! } ``` @@ -73,7 +72,7 @@ let results=[[ [ 1 ] ], ```js -function idMatrix (n) { +function idMatrix(n) { return Array.apply(null, new Array(n)).map(function (x, i, xs) { return xs.map(function (_, k) { return i === k ? 1 : 0; diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iterated-digits-squaring.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iterated-digits-squaring.english.md index b8fa1c578b..bdd98b6746 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iterated-digits-squaring.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/iterated-digits-squaring.english.md @@ -7,14 +7,15 @@ challengeType: 5 ## Description
If you add the square of the digits of a Natural number (an integer bigger than zero), you always end with either 1 or 89: -
15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
-7 -> 49 -> 97 -> 130 -> 10 -> 1
-Write a function that takes a number as a parameter and returns 1 or 89 after performing the mentioned process. +
+15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
+7 -> 49 -> 97 -> 130 -> 10 -> 1
+
## Instructions
- +Write a function that takes a number as a parameter and returns 1 or 89 after performing the mentioned process.
## Tests @@ -49,7 +50,7 @@ tests:
```js -function iteratedSquare (n) { +function iteratedSquare(n) { // Good luck! } ``` @@ -65,7 +66,7 @@ function iteratedSquare (n) { ```js -function iteratedSquare (n) { +function iteratedSquare(n) { var total; while (n != 89 && n != 1) { total = 0;