From 4462c12f77e24d2a2f3935c014b9845788b86bbb Mon Sep 17 00:00:00 2001 From: mtrx Date: Sat, 7 Dec 2024 01:29:29 +0100 Subject: [PATCH] completed 5 p2 --- solutions/05.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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