completed 5 p2
This commit is contained in:
parent
699d209501
commit
4462c12f77
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue