Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day13: Add another solution #836

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Day13: Add another solution
  • Loading branch information
rolandtritsch authored Dec 31, 2024
commit 7f43225d3557b1394e8ce9a8621ea03d9e23c97e
3 changes: 2 additions & 1 deletion docs/2024/puzzles/day13.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ extension (a: Long)
infix def safeDiv(b: Long): Option[Long] =
Option.when(b != 0 && a % b == 0)(a / b)
```

I've completed "Claw Contraption" - Day 13 - Advent of Code 2024 #AdventOfCode
we check that denominator is not zero and that numerator is divisible by denominator.

With the help of `safeDiv`, the solution can be cleanly expressed as:
Expand Down Expand Up @@ -228,6 +228,7 @@ def part2(input: String): Long =
- [Solution](https://github.com/TheDrawingCoder-Gamer/adventofcode2024/blob/e163baeaedcd90732b5e19f578a2faadeb1ef872/src/main/scala/Day13.scala) by [Bulby](https://github.com/TheDrawingCoder-Gamer)
- [Solution](https://github.com/jportway/advent2024/blob/master/src/main/scala/Day13.scala) by [Joshua Portway](https://github.com/jportway)
- [Solution](https://github.com/AvaPL/Advent-of-Code-2024/tree/main/src/main/scala/day13) by [Paweł Cembaluk](https://github.com/AvaPL)
- [Solution](https://github.com/rolandtritsch/scala3-aoc-2024/blob/trunk/main/src/aoc2024/Day13.scala) by [Roland Tritsch](https://github.com/rolandtritsch)

Share your solution to the Scala community by editing this page.
You can even write the whole article! [See here for the expected format](https://github.com/scalacenter/scala-advent-of-code/discussions/424)