diff --git a/snippets/selectionSort.md b/snippets/selectionSort.md index 1ac735fc8..3fcd2d0ce 100644 --- a/snippets/selectionSort.md +++ b/snippets/selectionSort.md @@ -12,14 +12,12 @@ Sorts an array of numbers, using the selection sort algorithm. ```js const selectionSort = arr => { const a = [...arr]; - for (let i = 0; i < a.length; i++) { const min = a .slice(i + 1) .reduce((acc, val, j) => (val < a[acc] ? j + i + 1 : acc), i); if (min !== i) [a[i], a[min]] = [a[min], a[i]]; } - return a; }; ```