Switched dequeue popping around

This commit is contained in:
Max Nuding 2021-12-10 07:43:23 +01:00
parent 984ae73600
commit ec5a7feb3f
Signed by: phlaym
GPG Key ID: A06651BAB6777237

View File

@ -44,8 +44,7 @@ struct Day10: Runnable {
} }
if !isIllegalLine { if !isIllegalLine {
var lineScore = 0 var lineScore = 0
s.reverse() while let last = s.popFirst() {
while let last = s.popLast() {
let charValue = last.closedBy!.autocompleteScore! let charValue = last.closedBy!.autocompleteScore!
lineScore = lineScore * 5 + charValue lineScore = lineScore * 5 + charValue
} }