fix(challenges): I problems

This commit is contained in:
Kris Koishigawa
2019-03-06 14:18:18 +09:00
committed by mrugesh
parent a3fd1aa284
commit 263d2c496b
4 changed files with 41 additions and 36 deletions

View File

@ -6,16 +6,22 @@ challengeType: 5
## Description
<section id='description'>
The phrase <a href="https://en.wikipedia.org/wiki/I before E except after C"> "I before E, except after C"</a> is a widely known mnemonic which is supposed to help when spelling English words.
The phrase <a href="https://en.wikipedia.org/wiki/I before E except after C" target="_blank"> "I before E, except after C"</a> 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:
<ol><li style='margin-bottom: 5px;'><i>"I before E when not preceded by C".</i></li><li><i>"E before I when preceded by C".</i></li></ol>
<ol>
<li>
<i>"I before E when not preceded by C".</i>
</li>
<li>
<i>"E before I when preceded by C".</i>
</li>
</ol>
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.
</section>
## Instructions
<section id='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.
</section>
## Tests

View File

@ -6,7 +6,7 @@ challengeType: 5
## Description
<section id='description'>
The <a href="https://en.wikipedia.org/wiki/International_Bank_Account_Number">International Bank Account Number (IBAN)</a> is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating <a href="https://en.wikipedia.org/wiki/Transcription_error">transcription errors</a>.
The <a href="https://en.wikipedia.org/wiki/International_Bank_Account_Number" target="_blank">International Bank Account Number (IBAN)</a> is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating <a href="https://en.wikipedia.org/wiki/Transcription_error" target="_blank">transcription errors</a>.
The IBAN consists of up to 34 alphanumeric characters:
<ul>
<li>first the two-letter ISO 3166-1 alpha-2 country code</li>
@ -14,12 +14,11 @@ The IBAN consists of up to 34 alphanumeric characters:
<li>finally a country-specific Basic Bank Account Number (BBAN).</li>
</ul>
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.
</section>
## Instructions
<section id='instructions'>
Write a function that takes IBAN string as parameter. If it is valid return true. Otherwise, return false.
</section>
## Tests

View File

@ -6,16 +6,15 @@ challengeType: 5
## Description
<section id='description'>
An <i>identity matrix</i> is a square matrix of size \( n \times n \),
where the diagonal elements are all <b>1</b>s (ones),
and all the other elements are all <b>0</b>s (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 <i>identity matrix</i> is a square matrix of size \( n \times n \), where the diagonal elements are all <b>1</b>s (ones), and all the other elements are all <b>0</b>s (zeroes).
<ul>
<li style="list-style: none;">\(\displaystyle I_{n}=\begin{bmatrix} 1 & 0 & 0 \cr 0 & 1 & 0 \cr 0 & 0 & 1 \cr \end{bmatrix}\)</li>
</ul>
</section>
## Instructions
<section id='instructions'>
Write a function that takes a number <code>n</code> as a parameter and returns the identity matrix of order \( n \times n \).
</section>
## Tests
@ -27,14 +26,14 @@ tests:
testString: assert(typeof idMatrix=='function','<code>idMatrix</code> should be a function.');
- text: <code>idMatrix(1)</code> should return an array.
testString: assert(Array.isArray(idMatrix(1)),'<code>idMatrix(1)</code> should return an array.');
- text: <code>idMatrix(1)</code> should return <code>'+JSON.stringify(results[0])+'</code>.
testString: assert.deepEqual(idMatrix(1),results[0],'<code>idMatrix(1)</code> should return <code>'+JSON.stringify(results[0])+'</code>.');
- text: <code>idMatrix(2)</code> should return <code>'+JSON.stringify(results[1])+'</code>.
testString: assert.deepEqual(idMatrix(2),results[1],'<code>idMatrix(2)</code> should return <code>'+JSON.stringify(results[1])+'</code>.');
- text: <code>idMatrix(3)</code> should return <code>'+JSON.stringify(results[2])+'</code>.
testString: assert.deepEqual(idMatrix(3),results[2],'<code>idMatrix(3)</code> should return <code>'+JSON.stringify(results[2])+'</code>.');
- text: <code>idMatrix(4)</code> should return <code>'+JSON.stringify(results[3])+'</code>.
testString: assert.deepEqual(idMatrix(4),results[3],'<code>idMatrix(4)</code> should return <code>'+JSON.stringify(results[3])+'</code>.');
- text: <code>idMatrix(1)</code> should return <code>[ [ 1 ] ]</code>.
testString: assert.deepEqual(idMatrix(1),results[0]);
- text: <code>idMatrix(2)</code> should return <code>[ [ 1, 0 ], [ 0, 1 ] ]</code>.
testString: assert.deepEqual(idMatrix(2),results[1]);
- text: <code>idMatrix(3)</code> should return <code>[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]</code>.
testString: assert.deepEqual(idMatrix(3),results[2]);
- text: <code>idMatrix(4)</code> should return <code>[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]</code>.
testString: assert.deepEqual(idMatrix(4),results[3]);
```

View File

@ -7,14 +7,15 @@ challengeType: 5
## Description
<section id='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:
<pre>15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
7 -> 49 -> 97 -> 130 -> 10 -> 1</pre>
Write a function that takes a number as a parameter and returns 1 or 89 after performing the mentioned process.
<pre>
15 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89
7 -> 49 -> 97 -> 130 -> 10 -> 1
</pre>
</section>
## Instructions
<section id='instructions'>
Write a function that takes a number as a parameter and returns 1 or 89 after performing the mentioned process.
</section>
## Tests