diff --git a/challenges/08-coding-interview-prep/rosetta-code.json b/challenges/08-coding-interview-prep/rosetta-code.json
index df0fc8c4b..c5445ecd3 100644
--- a/challenges/08-coding-interview-prep/rosetta-code.json
+++ b/challenges/08-coding-interview-prep/rosetta-code.json
@@ -4841,31 +4841,31 @@
{
"text": "'IBeforeExceptC
should be a function.'",
"testString": "assert(typeof IBeforeExceptC=='function','IBeforeExceptC
should be a function.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"receive\")
should return a boolean.'",
"testString": "assert(typeof IBeforeExceptC(\"receive\")=='boolean','IBeforeExceptC(\"receive\")
should return a boolean.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"receive\")
should return true
.'",
"testString": "assert.equal(IBeforeExceptC(\"receive\"),true,'IBeforeExceptC(\"receive\")
should return true
.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"science\")
should return false
.'",
"testString": "assert.equal(IBeforeExceptC(\"science\"),false,'IBeforeExceptC(\"science\")
should return false
.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"imperceivable\")
should return true
.'",
"testString": "assert.equal(IBeforeExceptC(\"imperceivable\"),true,'IBeforeExceptC(\"imperceivable\")
should return true
.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"inconceivable\")
should return true
.'",
"testString": "assert.equal(IBeforeExceptC(\"inconceivable\"),true,'IBeforeExceptC(\"inconceivable\")
should return true
.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"insufficient\")
should return false
.'",
"testString": "assert.equal(IBeforeExceptC(\"insufficient\"),false,'IBeforeExceptC(\"insufficient\")
should return false
.');"
- },
+ },
{
"text": "'IBeforeExceptC(\"omniscient\")
should return false
.'",
"testString": "assert.equal(IBeforeExceptC(\"omniscient\"),false,'IBeforeExceptC(\"omniscient\")
should return false
.');"
@@ -4880,8 +4880,8 @@
"ext": "js",
"name": "index",
"contents": [
- "function IBeforeExceptC (word) {",
- " // Good luck!",
+ "function IBeforeExceptC (word) {",
+ " // Good luck!",
"}"
],
"head": [],
@@ -4892,12 +4892,12 @@
{
"title": "IBAN",
"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 IBAN consists of up to 34 alphanumeric characters:", "
isValid
should be a function.'",
"testString": "assert(typeof isValid=='function','isValid
should be a function.');"
- },
+ },
{
"text": "'isValid(\"'+tests[0]+'\")
should return a boolean.'",
"testString": "assert(typeof isValid(tests[0])=='boolean','isValid(\"'+tests[0]+'\")
should return a boolean.');"
- },
+ },
{
"text": "'isValid(\"'+tests[0]+'\")
should return true
.'",
"testString": "assert.equal(isValid(tests[0]),true,'isValid(\"'+tests[0]+'\")
should return true
.');"
- },
+ },
{
"text": "'isValid(\"'+tests[1]+'\")
should return false
.'",
"testString": "assert.equal(isValid(tests[1]),false,'isValid(\"'+tests[1]+'\")
should return false
.');"
- },
+ },
{
"text": "'isValid(\"'+tests[2]+'\")
should return false
.'",
"testString": "assert.equal(isValid(tests[2]),false,'isValid(\"'+tests[2]+'\")
should return false
.');"
- },
+ },
{
"text": "'isValid(\"'+tests[3]+'\")
should return false
.'",
"testString": "assert.equal(isValid(tests[3]),false,'isValid(\"'+tests[3]+'\")
should return false
.');"
- },
+ },
{
"text": "'isValid(\"'+tests[4]+'\")
should return true
.'",
"testString": "assert.equal(isValid(tests[4]),true,'isValid(\"'+tests[4]+'\")
should return true
.');"
@@ -4942,486 +4942,18 @@
"ext": "js",
"name": "index",
"contents": [
- "function isValid (iban) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": [
- "let tests=[",
- "'GB82 WEST 1234 5698 7654 32',",
- "'GB82 WEST 1.34 5698 7654 32',",
- "'GB82 WEST 1234 5698 7654 325',",
- "'GB82 TEST 1234 5698 7654 32',",
- "'SA03 8000 0000 6080 1016 7519'",
- "]"
- ]
- }
- }
- },
- {
- "title": "Identity matrix",
- "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."
- ],
- "solutions": [
- "function idMatrix (n) {\n\treturn Array.apply(null, new Array(n)).map(function (x, i, xs) {\n\t\treturn xs.map(function (_, k) {\n\t\t\treturn i === k ? 1 : 0;\n\t\t})\n\t});\n}\n"
- ],
- "tests": [
- {
- "text": "'idMatrix
should be a function.'",
- "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])+'
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7eb1",
- "challengeType": 5,
- "releasedOn": "June 8, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function idMatrix (n) {", " // Good luck!", "}"
- ],
- "head": [],
- "tail": [
- "let results=[[ [ 1 ] ],",
- "[ [ 1, 0 ], [ 0, 1 ] ],",
- "[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],",
- "[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]]"
- ]
- }
- }
- },
- {
- "title": "Iterated digits squaring",
- "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." - ], - "solutions": [ - "function iteratedSquare (n) {\n\tvar total;\n\twhile (n != 89 && n != 1) {\n\t\ttotal = 0;\n\t\twhile (n > 0) {\n\t\t\ttotal += Math.pow(n % 10, 2);\n\t\t\tn = Math.floor(n/10);\n\t\t}\n\t\tn = total;\n\t}\n\treturn n;\n}\n" - ], - "tests": [ - { - "text": "'
iteratedSquare
should be a function.'",
- "testString": "assert(typeof iteratedSquare=='function','iteratedSquare
should be a function.');"
- },
- {
- "text": "'iteratedSquare(4)
should return a number.'",
- "testString": "assert(typeof iteratedSquare(4)=='number','iteratedSquare(4)
should return a number.');"
- },
- {
- "text": "'iteratedSquare(4)
should return 89
.'",
- "testString": "assert.equal(iteratedSquare(4),89,'iteratedSquare(4)
should return 89
.');"
- },
- {
- "text": "'iteratedSquare(7)
should return 1
.'",
- "testString": "assert.equal(iteratedSquare(7),1,'iteratedSquare(7)
should return 1
.');"
- },
- {
- "text": "'iteratedSquare(15)
should return 89
.'",
- "testString": "assert.equal(iteratedSquare(15),89,'iteratedSquare(15)
should return 89
.');"
- },
- {
- "text": "'iteratedSquare(20)
should return 89
.'",
- "testString": "assert.equal(iteratedSquare(20),89,'iteratedSquare(20)
should return 89
.');"
- },
- {
- "text": "'iteratedSquare(70)
should return 1
.'",
- "testString": "assert.equal(iteratedSquare(70),1,'iteratedSquare(70)
should return 1
.');"
- },
- {
- "text": "'iteratedSquare(100)
should return 1
.'",
- "testString": "assert.equal(iteratedSquare(100),1,'iteratedSquare(100)
should return 1
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7ec1",
- "challengeType": 5,
- "releasedOn": "June 8, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function iteratedSquare (n) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": []
- }
- }
- },
- {
- "title": "Jaro distance",
- "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 \\( 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: jaro
should be a function.'",
- "testString": "assert(typeof jaro=='function','jaro
should be a function.');"
- },
- {
- "text": "'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return a number.'",
- "testString": "assert(typeof jaro(tests[0][0],tests[0][1])=='number','jaro()
should return a number.');"
- },
- {
- "text": "'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return '+results[0]+'
.'",
- "testString": "assert.equal(jaro(tests[0][0],tests[0][1]),results[0],'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return '+results[0]+'
.');"
- },
- {
- "text": "'jaro(\"'+tests[1][0]+'\",\"'+tests[1][1]+'\")
should return '+results[1]+'
.'",
- "testString": "assert.equal(jaro(tests[1][0],tests[1][1]),results[1],'jaro(\"'+tests[1][0]+'\",\"'+tests[1][1]+'\")
should return '+results[1]+'
.');"
- },
- {
- "text": "'jaro(\"'+tests[2][0]+'\",\"'+tests[2][1]+'\")
should return '+results[2]+'
.'",
- "testString": "assert.equal(jaro(tests[2][0],tests[2][1]),results[2],'jaro(\"'+tests[2][0]+'\",\"'+tests[2][1]+'\")
should return '+results[2]+'
.');"
- },
- {
- "text": "'jaro(\"'+tests[3][0]+'\",\"'+tests[3][1]+'\")
should return '+results[3]+'
.'",
- "testString": "assert.equal(jaro(tests[3][0],tests[3][1]),results[3],'jaro(\"'+tests[3][0]+'\",\"'+tests[3][1]+'\")
should return '+results[3]+'
.');"
- },
- {
- "text": "'jaro(\"'+tests[4][0]+'\",\"'+tests[4][1]+'\")
should return '+results[4]+'
.'",
- "testString": "assert.equal(jaro(tests[4][0],tests[4][1]),results[4],'jaro(\"'+tests[4][0]+'\",\"'+tests[4][1]+'\")
should return '+results[4]+'
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7ec2",
- "challengeType": 5,
- "releasedOn": "June 9, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function jaro (s, t) {",
+ "function isValid (iban) {",
" // Good luck!",
"}"
],
"head": [],
"tail": [
"let tests=[",
- "[\"MARTHA\", \"MARHTA\"],",
- "[\"DIXON\", \"DICKSONX\"],",
- "[\"JELLYFISH\", \"SMELLYFISH\"],",
- "[\"HELLOS\", \"CHELLO\"],",
- "[\"ABCD\", \"BCDA\"]",
- "]",
- "let results=[",
- "0.9444444444444445,",
- "0.7666666666666666,",
- "0.8962962962962964,",
- "0.888888888888889,",
- "0.8333333333333334",
- "]"
- ]
- }
- }
- },
- {
- "title": "JortSort",
- "description": [
- "jortSort is a sorting toolset that makes the user do the work and guarantees efficiency because you don't have to sort ever again. It was originally presented by Jenn \"Moneydollars\" Schiffer at the prestigious JSConf.",
- "jortSort is a function that takes a single array of comparable objects as its argument. It then sorts the array in ascending order and compares the sorted array to the originally provided array. If the arrays match (i.e. the original array was already sorted), the function returns true. If the arrays do not match (i.e. the original array was not sorted), the function returns false."
- ],
- "solutions": [
- "function jortsort (array) {\n // sort the array\n var originalArray = array.slice(0);\n array.sort( function(a,b){return a - b} );\n\n // compare to see if it was originally sorted\n for (var i = 0; i < originalArray.length; ++i) {\n if (originalArray[i] !== array[i]) return false;\n }\n\n return true;\n};\n"
- ],
- "tests": [
- {
- "text": "'jortsort
should be a function.'",
- "testString": "assert(typeof jortsort=='function','jortsort
should be a function.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[0])+')
should return a boolean.'",
- "testString": "assert(typeof jortsort(tests[0].slice())=='boolean','jortsort('+JSON.stringify(tests[0])+')
should return a boolean.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[0])+')
should return true
.'",
- "testString": "assert.equal(jortsort(tests[0].slice()),true,'jortsort('+JSON.stringify(tests[0])+')
should return true
.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[1])+')
should return false
.'",
- "testString": "assert.equal(jortsort(tests[1].slice()),false,'jortsort('+JSON.stringify(tests[1])+')
should return false
.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[2])+')
should return false
.'",
- "testString": "assert.equal(jortsort(tests[2].slice()),false,'jortsort('+JSON.stringify(tests[2])+')
should return false
.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[3])+')
should return true
.'",
- "testString": "assert.equal(jortsort(tests[3].slice()),true,'jortsort('+JSON.stringify(tests[3])+')
should return true
.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[4])+')
should return false
.'",
- "testString": "assert.equal(jortsort(tests[4].slice()),false,'jortsort('+JSON.stringify(tests[4])+')
should return false
.');"
- },
- {
- "text": "'jortsort('+JSON.stringify(tests[5])+')
should return true
.'",
- "testString": "assert.equal(jortsort(tests[5].slice()),true,'jortsort('+JSON.stringify(tests[5])+')
should return true
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7ec4",
- "challengeType": 5,
- "releasedOn": "June 9, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function jortsort (array) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": [
- "let tests=[[1,2,3,4,5],",
- "[1,2,13,4,5],",
- "[12,4,51,2,4],",
- "[1,2],",
- "[5,4,3,2,1],",
- "[1,1,1,1,1]]"
- ]
- }
- }
- },
- {
- "title": "Josephus problem",
- "description": [
- "Josephus problem is a math puzzle with a grim description: $n$ prisoners are standing on a circle, sequentially numbered from $0$ to $n-1$.",
- "An executioner walks along the circle, starting from prisoner $0$, removing every $k$-th prisoner and killing him.",
- "As the process goes on, the circle becomes smaller and smaller, until only one prisoner remains, who is then freed.",
- "For example, if there are $n=5$ prisoners and $k=2$, the order the prisoners are killed in (let's call it the \"killing sequence\") will be 1, 3, 0, and 4, and the survivor will be #2.",
- "Given any $n, k > 0$, find out which prisoner will be the final survivor.",
- "In one such incident, there were 41 prisoners and every 3rd prisoner was being killed ($k=3$).",
- "Among them was a clever chap name Josephus who worked out the problem, stood at the surviving position, and lived on to tell the tale.",
- "Which number was he?",
- "Write a function that takes the initial number of prisoners and 'k' as parameter and returns the number of the prisoner that survives."
- ],
- "solutions": [
- "function josephus (init, kill) {\n var Josephus = {\n init: function(n) {\n this.head = {};\n var current = this.head;\n for (var i = 0; i < n - 1; i++) {\n current.label = i + 1;\n current.next = {\n prev: current\n };\n current = current.next;\n }\n current.label = n;\n current.next = this.head;\n this.head.prev = current;\n return this;\n },\n kill: function(spacing) {\n var current = this.head;\n while (current.next !== current) {\n for (var i = 0; i < spacing - 1; i++) {\n current = current.next;\n }\n current.prev.next = current.next;\n current.next.prev = current.prev;\n current = current.next;\n }\n return current.label;\n }\n }\n\n return Josephus.init(init).kill(kill)\n}\n\n"
- ],
- "tests": [
- {
- "text": "'josephus
should be a function.'",
- "testString": "assert(typeof josephus=='function','josephus
should be a function.');"
- },
- {
- "text": "'josephus(30,3)
should return a number.'",
- "testString": "assert(typeof josephus(30,3)=='number','josephus(30,3)
should return a number.');"
- },
- {
- "text": "'josephus(30,3)
should return 29
.'",
- "testString": "assert.equal(josephus(30,3),29,'josephus(30,3)
should return 29
.');"
- },
- {
- "text": "'josephus(30,5)
should return 3
.'",
- "testString": "assert.equal(josephus(30,5),3,'josephus(30,5)
should return 3
.');"
- },
- {
- "text": "'josephus(20,2)
should return 9
.'",
- "testString": "assert.equal(josephus(20,2),9,'josephus(20,2)
should return 9
.');"
- },
- {
- "text": "'josephus(17,6)
should return 2
.'",
- "testString": "assert.equal(josephus(17,6),2,'josephus(17,6)
should return 2
.');"
- },
- {
- "text": "'josephus(29,4)
should return 2
.'",
- "testString": "assert.equal(josephus(29,4),2,'josephus(29,4)
should return 2
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7ec5",
- "challengeType": 5,
- "releasedOn": "June 9, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function josephus (init, kill) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": []
- }
- }
- },
- {
- "title": "I before E except after C",
- "description": [
- "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:",
- "IBeforeExceptC
should be a function.'",
- "testString": "assert(typeof IBeforeExceptC=='function','IBeforeExceptC
should be a function.');"
- },
- {
- "text": "'IBeforeExceptC(\"receive\")
should return a boolean.'",
- "testString": "assert(typeof IBeforeExceptC(\"receive\")=='boolean','IBeforeExceptC(\"receive\")
should return a boolean.');"
- },
- {
- "text": "'IBeforeExceptC(\"receive\")
should return true
.'",
- "testString": "assert.equal(IBeforeExceptC(\"receive\"),true,'IBeforeExceptC(\"receive\")
should return true
.');"
- },
- {
- "text": "'IBeforeExceptC(\"science\")
should return false
.'",
- "testString": "assert.equal(IBeforeExceptC(\"science\"),false,'IBeforeExceptC(\"science\")
should return false
.');"
- },
- {
- "text": "'IBeforeExceptC(\"imperceivable\")
should return true
.'",
- "testString": "assert.equal(IBeforeExceptC(\"imperceivable\"),true,'IBeforeExceptC(\"imperceivable\")
should return true
.');"
- },
- {
- "text": "'IBeforeExceptC(\"inconceivable\")
should return true
.'",
- "testString": "assert.equal(IBeforeExceptC(\"inconceivable\"),true,'IBeforeExceptC(\"inconceivable\")
should return true
.');"
- },
- {
- "text": "'IBeforeExceptC(\"insufficient\")
should return false
.'",
- "testString": "assert.equal(IBeforeExceptC(\"insufficient\"),false,'IBeforeExceptC(\"insufficient\")
should return false
.');"
- },
- {
- "text": "'IBeforeExceptC(\"omniscient\")
should return false
.'",
- "testString": "assert.equal(IBeforeExceptC(\"omniscient\"),false,'IBeforeExceptC(\"omniscient\")
should return false
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7eb0",
- "challengeType": 5,
- "releasedOn": "June 8, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function IBeforeExceptC (word) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": []
- }
- }
- },
- {
- "title": "IBAN",
- "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 IBAN consists of up to 34 alphanumeric characters:", "isValid
should be a function.');"
- },
- {
- "text": "'isValid(\"'+tests[0]+'\")
should return a boolean.'",
- "testString": "assert(typeof isValid(tests[0])=='boolean','isValid(\"'+tests[0]+'\")
should return a boolean.');"
- },
- {
- "text": "'isValid(\"'+tests[0]+'\")
should return true
.'",
- "testString": "assert.equal(isValid(tests[0]),true,'isValid(\"'+tests[0]+'\")
should return true
.');"
- },
- {
- "text": "'isValid(\"'+tests[1]+'\")
should return false
.'",
- "testString": "assert.equal(isValid(tests[1]),false,'isValid(\"'+tests[1]+'\")
should return false
.');"
- },
- {
- "text": "'isValid(\"'+tests[2]+'\")
should return false
.'",
- "testString": "assert.equal(isValid(tests[2]),false,'isValid(\"'+tests[2]+'\")
should return false
.');"
- },
- {
- "text": "'isValid(\"'+tests[3]+'\")
should return false
.'",
- "testString": "assert.equal(isValid(tests[3]),false,'isValid(\"'+tests[3]+'\")
should return false
.');"
- },
- {
- "text": "'isValid(\"'+tests[4]+'\")
should return true
.'",
- "testString": "assert.equal(isValid(tests[4]),true,'isValid(\"'+tests[4]+'\")
should return true
.');"
- }
- ],
- "id": "5a23c84252665b21eecc7eaf",
- "challengeType": 5,
- "releasedOn": "June 8, 2018",
- "files": {
- "indexjs": {
- "key": "indexjs",
- "ext": "js",
- "name": "index",
- "contents": [
- "function isValid (iban) {",
- " // Good luck!",
- "}"
- ],
- "head": [],
- "tail": [
- "let tests=[",
- "'GB82 WEST 1234 5698 7654 32',",
+ "'GB82 WEST 1234 5698 7654 32',",
"'GB82 WEST 1.34 5698 7654 32',",
- "'GB82 WEST 1234 5698 7654 325',",
- "'GB82 TEST 1234 5698 7654 32',",
- "'SA03 8000 0000 6080 1016 7519'",
+ "'GB82 WEST 1234 5698 7654 325',",
+ "'GB82 TEST 1234 5698 7654 32',",
+ "'SA03 8000 0000 6080 1016 7519'",
"]"
]
}
@@ -5478,9 +5010,9 @@
],
"head": [],
"tail": [
- "let results=[[ [ 1 ] ],",
- "[ [ 1, 0 ], [ 0, 1 ] ],",
- "[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],",
+ "let results=[[ [ 1 ] ],",
+ "[ [ 1, 0 ], [ 0, 1 ] ],",
+ "[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],",
"[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ]]"
]
}
@@ -5501,31 +5033,31 @@
{
"text": "'iteratedSquare
should be a function.'",
"testString": "assert(typeof iteratedSquare=='function','iteratedSquare
should be a function.');"
- },
+ },
{
"text": "'iteratedSquare(4)
should return a number.'",
"testString": "assert(typeof iteratedSquare(4)=='number','iteratedSquare(4)
should return a number.');"
- },
+ },
{
"text": "'iteratedSquare(4)
should return 89
.'",
"testString": "assert.equal(iteratedSquare(4),89,'iteratedSquare(4)
should return 89
.');"
- },
+ },
{
"text": "'iteratedSquare(7)
should return 1
.'",
"testString": "assert.equal(iteratedSquare(7),1,'iteratedSquare(7)
should return 1
.');"
- },
+ },
{
"text": "'iteratedSquare(15)
should return 89
.'",
"testString": "assert.equal(iteratedSquare(15),89,'iteratedSquare(15)
should return 89
.');"
- },
+ },
{
"text": "'iteratedSquare(20)
should return 89
.'",
"testString": "assert.equal(iteratedSquare(20),89,'iteratedSquare(20)
should return 89
.');"
- },
+ },
{
"text": "'iteratedSquare(70)
should return 1
.'",
"testString": "assert.equal(iteratedSquare(70),1,'iteratedSquare(70)
should return 1
.');"
- },
+ },
{
"text": "'iteratedSquare(100)
should return 1
.'",
"testString": "assert.equal(iteratedSquare(100),1,'iteratedSquare(100)
should return 1
.');"
@@ -5570,27 +5102,27 @@
{
"text": "'jaro
should be a function.'",
"testString": "assert(typeof jaro=='function','jaro
should be a function.');"
- },
+ },
{
"text": "'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return a number.'",
"testString": "assert(typeof jaro(tests[0][0],tests[0][1])=='number','jaro()
should return a number.');"
- },
+ },
{
"text": "'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return '+results[0]+'
.'",
"testString": "assert.equal(jaro(tests[0][0],tests[0][1]),results[0],'jaro(\"'+tests[0][0]+'\",\"'+tests[0][1]+'\")
should return '+results[0]+'
.');"
- },
+ },
{
"text": "'jaro(\"'+tests[1][0]+'\",\"'+tests[1][1]+'\")
should return '+results[1]+'
.'",
"testString": "assert.equal(jaro(tests[1][0],tests[1][1]),results[1],'jaro(\"'+tests[1][0]+'\",\"'+tests[1][1]+'\")
should return '+results[1]+'
.');"
- },
+ },
{
"text": "'jaro(\"'+tests[2][0]+'\",\"'+tests[2][1]+'\")
should return '+results[2]+'
.'",
"testString": "assert.equal(jaro(tests[2][0],tests[2][1]),results[2],'jaro(\"'+tests[2][0]+'\",\"'+tests[2][1]+'\")
should return '+results[2]+'
.');"
- },
+ },
{
"text": "'jaro(\"'+tests[3][0]+'\",\"'+tests[3][1]+'\")
should return '+results[3]+'
.'",
"testString": "assert.equal(jaro(tests[3][0],tests[3][1]),results[3],'jaro(\"'+tests[3][0]+'\",\"'+tests[3][1]+'\")
should return '+results[3]+'
.');"
- },
+ },
{
"text": "'jaro(\"'+tests[4][0]+'\",\"'+tests[4][1]+'\")
should return '+results[4]+'
.'",
"testString": "assert.equal(jaro(tests[4][0],tests[4][1]),results[4],'jaro(\"'+tests[4][0]+'\",\"'+tests[4][1]+'\")
should return '+results[4]+'
.');"
@@ -5681,8 +5213,8 @@
"ext": "js",
"name": "index",
"contents": [
- "function jortsort (array) {",
- " // Good luck!",
+ "function jortsort (array) {",
+ " // Good luck!",
"}"
],
"head": [],