diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.english.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.english.md index 3c30fbf0d8..957839641f 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.english.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-insertion-sort.english.md @@ -30,7 +30,7 @@ tests: - text: insertionSort should return an array that is unchanged except for order. testString: assert.sameMembers(insertionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]); - text: insertionSort should not use the built-in .sort() method. - testString: assert(!code.match(/\.?[\s\S]*?sort/)); + testString: assert(!code.match(/\.\s*sort\s*\(/)); ``` diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.english.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.english.md index d9748ddd6e..ed24736b81 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.english.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-merge-sort.english.md @@ -34,7 +34,7 @@ tests: - text: mergeSort should return an array that is unchanged except for order. testString: assert.sameMembers(mergeSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]); - text: mergeSort should not use the built-in .sort() method. - testString: assert(!removeJSComments(code).match(/\.?[\s\S]*?sort\s*\(/)); + testString: assert(!removeJSComments(code).match(/\.\s*sort\s*\(/)); ``` diff --git a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.english.md b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.english.md index 1804a32f1d..d5e03340b9 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.english.md +++ b/curriculum/challenges/english/10-coding-interview-prep/algorithms/implement-selection-sort.english.md @@ -30,7 +30,7 @@ tests: - text: selectionSort should return an array that is unchanged except for order. testString: assert.sameMembers(selectionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]); - text: selectionSort should not use the built-in .sort() method. - testString: assert(!code.match(/\.?[\s\S]*?sort/)); + testString: assert(!code.match(/\.\s*sort\s*\(/)); ``` @@ -76,17 +76,17 @@ function isSorted(arr) { function selectionSort(array) { for (let i = 0; i < array.length-1; i++) { let minimumIndex = i; - for (let j = i+1; j < array.length; j++){ + for (let j = i+1; j < array.length; j++){ if (array[j] < array[minimumIndex]) { minimumIndex = j; } } let value = array[minimumIndex]; - array[minimumIndex] = array[i]; - array[i] = value; - } + array[minimumIndex] = array[i]; + array[i] = value; + } return array; -} +} ```