@@ -54,6 +59,7 @@ function standardDeviation(arr) {
## Solution
+
```js
@@ -64,10 +70,10 @@ function standardDeviation(arr) {
arr.forEach(function(e) {
sum += e;
sum_sq += e * e;
- })
+ });
- var std_dev=Math.sqrt((sum_sq / n) - Math.pow(sum / n, 2))
- return Math.round(std_dev*1000)/1000;
+ var std_dev = Math.sqrt(sum_sq / n - Math.pow(sum / n, 2));
+ return Math.round(std_dev * 1000) / 1000;
}
```
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cusip.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cusip.english.md
index cf0b711bea..30cb2ea4c5 100644
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cusip.english.md
+++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cusip.english.md
@@ -6,46 +6,51 @@ forumTopicId: 302241
---
## Description
+
A CUSIP is a nine-character alphanumeric code that identifies a North American financial security for the purposes of facilitating clearing and settlement of trades. The CUSIP was adopted as an American National Standard under Accredited Standards X9.6.
+
## Instructions
+
Write a function that takes a string as a parameter and checks if the string is valid CUSIP.
## Tests
+
-``` yml
+```yml
tests:
- text: isCusip should be a function.
- testString: assert(typeof isCusip == 'function', 'isCusip should be a function.');
+ testString: assert(typeof isCusip == 'function');
- text: isCusip("037833100") should return a boolean.
- testString: assert(typeof isCusip("037833100") == 'boolean', 'isCusip("037833100") should return a boolean.');
+ testString: assert(typeof isCusip("037833100") == 'boolean');
- text: isCusip("037833100") should return true.
- testString: assert.equal(isCusip("037833100"), true, 'isCusip("037833100") should return true.');
+ testString: assert.equal(isCusip("037833100"), true);
- text: isCusip("17275R102") should return true.
- testString: assert.equal(isCusip("17275R102"), true, 'isCusip("17275R102") should return true.');
+ testString: assert.equal(isCusip("17275R102"), true);
- text: isCusip("38259P50a") should return false.
- testString: assert.equal(isCusip("38259P50a"), false, 'isCusip("38259P50a") should return false.');
+ testString: assert.equal(isCusip("38259P50a"), false);
- text: isCusip("38259P508") should return true.
- testString: assert.equal(isCusip("38259P508"), true, 'isCusip("38259P508") should return true.');
+ testString: assert.equal(isCusip("38259P508"), true);
- text: isCusip("38259P50#") should return false.
- testString: assert.equal(isCusip("38259P50#"), false, 'isCusip("38259P50#") should return false.');
+ testString: assert.equal(isCusip("38259P50#"), false);
- text: isCusip("68389X105") should return true.
- testString: assert.equal(isCusip("68389X105"), true, 'isCusip("68389X105") should return true.');
+ testString: assert.equal(isCusip("68389X105"), true);
- text: isCusip("68389X106") should return false.
- testString: assert.equal(isCusip("68389X106"), false, 'isCusip("68389X106") should return false.');
+ testString: assert.equal(isCusip("68389X106"), false);
- text: isCusip("5949181") should return false.
- testString: assert.equal(isCusip("5949181"), false, 'isCusip("5949181") should return false.');
+ testString: assert.equal(isCusip("5949181"), false);
```
## Challenge Seed
+
@@ -60,6 +65,7 @@ function isCusip(s) {
## Solution
+
```js
@@ -85,7 +91,7 @@ function isCusip(s) {
return false;
}
if (i % 2 == 1) v *= 2; // check if odd as using 0-based indexing
- sum += Math.floor(v / 10) + v % 10;
+ sum += Math.floor(v / 10) + (v % 10);
}
return s.charCodeAt(8) - 48 == (10 - (sum % 10)) % 10;
}
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.english.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.english.md
index 027788a550..0a5e447c63 100644
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.english.md
+++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/cut-a-rectangle.english.md
@@ -6,9 +6,11 @@ forumTopicId: 302242
---
## Description
+
A given rectangle is made from m × n squares. If m and n are not both odd, then it is possible to cut a path through the rectangle along the square edges such that the rectangle splits into two connected pieces with the same shape (after rotating one of the pieces by 180°). All such paths for 2 × 2 and 4 × 3 rectangles are shown below.
+