Fixed sorting issue that caused the median calculation bug.

This commit is contained in:
softsimon
2020-03-20 02:07:12 +07:00
parent 72658c19f6
commit e84ec7dd86
2 changed files with 2 additions and 6 deletions

View File

@@ -92,7 +92,6 @@ class Blocks {
private median(numbers: number[]) {
let medianNr = 0;
const numsLen = numbers.length;
numbers.sort();
if (numsLen % 2 === 0) {
medianNr = (numbers[numsLen / 2 - 1] + numbers[numsLen / 2]) / 2;
} else {