Skip to content

Commit c66f97b

Browse files
committed
refactor(07/2025): merge two ifs into one
1 parent 226a4ca commit c66f97b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@
7777
| [Day 22: Sand Slabs](src/solutions/year2023/day22.rs) | ⭐⭐ | 55.959 | 135.398 |
7878
| [Day 23: A Long Walk](src/solutions/year2023/day23.rs) | ⭐⭐ | 6.943 | 10855.790 |
7979
| [Day 24: Never Tell Me The Odds](src/solutions/year2023/day24.rs) || 2.406 | - |
80-
| [Day 25: Snowverload](src/solutions/year2023/day25.rs) | | - | - |
80+
| [Day 25: Snowverload](src/solutions/year2023/day25.rs) | | - | - |
81+
82+
# TODO
83+
- if result for given day was invalid, save it in cache and avoid sending again

src/solutions/year2025/day07.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ impl Solution for Day07 {
2929
result_beams.push(current_beam);
3030

3131
for split in down.split() {
32-
if result_beams.iter().any(|beam| beam.collides(&split)) {
33-
continue;
34-
}
35-
36-
if current_beams.iter().any(|beam| beam.collides(&split)) {
32+
if result_beams
33+
.iter()
34+
.chain(current_beams.iter())
35+
.any(|beam| beam.collides(&split))
36+
{
3737
continue;
3838
}
3939

0 commit comments

Comments
 (0)