diff --git a/solutions/05.ts b/solutions/05.ts index e640ff9..0b639c2 100644 --- a/solutions/05.ts +++ b/solutions/05.ts @@ -47,8 +47,8 @@ class DayFive implements Solvable { const [compliant, leftIdx, rightIdx] = this.followsRules(update) if (!compliant) { // remove offending item and just move it to the back - const removedLeft = update.splice(leftIdx, 1) - const rebuiltUpdate = [...update.slice(0, rightIdx), removedLeft[0], ...update.slice(rightIdx, -1)] + const removedLeft = update.splice(leftIdx, 1)[0] + const rebuiltUpdate = [...update.slice(0, rightIdx), removedLeft, ...update.slice(rightIdx)] return sort(rebuiltUpdate) } else { return update