Fixed sorting issue that caused the median calculation bug.

This commit is contained in:
softsimon
2020-03-20 02:07:12 +07:00
parent aca1b20772
commit 3ed0e38582
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 {