We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d12638 commit 6bd6072Copy full SHA for 6bd6072
src/algorithms/sorting/counting-sort/__test__/CountingSort.test.js
@@ -27,14 +27,10 @@ describe('CountingSort', () => {
27
const sorter = new CountingSort({ visitingCallback });
28
29
// Detect biggest number in array in prior.
30
- const biggestElement = notSortedArr.reduce((accumulator, element) => {
31
- return element > accumulator ? element : accumulator;
32
- }, 0);
+ const biggestElement = Math.max(...notSortedArr);
33
34
// Detect smallest number in array in prior.
35
- const smallestElement = notSortedArr.reduce((accumulator, element) => {
36
- return element < accumulator ? element : accumulator;
37
+ const smallestElement = Math.min(...notSortedArr);
38
39
const sortedArray = sorter.sort(notSortedArr, smallestElement, biggestElement);
40
0 commit comments