Skip to content

Commit bb7d8e5

Browse files
committed
refac(angch/2025-07): Cleanup
1 parent 98f27f9 commit bb7d8e5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

angch/2025-07/main.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ func day7(file string) (part1, part2 int) {
2626
break
2727
}
2828
if c == '^' && beams[x] > 0 {
29-
if x > 0 {
30-
beams[x-1] += beams[x]
31-
}
32-
if x < len(t) {
33-
beams[x+1] += beams[x]
34-
}
35-
beams[x] = 0
29+
// Looks cleaner like this, splitting the beams[x]:
30+
beams[x-1], beams[x], beams[x+1] =
31+
beams[x-1]+beams[x], 0, beams[x+1]+beams[x]
3632
part1++
3733
}
3834
}

0 commit comments

Comments
 (0)