Last active
December 4, 2025 16:03
-
-
Save ab5tract/7f5410af74e11e056f77fd0a8a1117f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use v6.*; | |
| my @input = "day3.input".IO.lines; | |
| #my @input = [ "23191392", "14928318" ]; | |
| my $total = 0; | |
| for @input.map(*.comb>>.Int) -> @i { | |
| my ($idx,$first) = @i.max(:kv); | |
| my $second; | |
| if $idx == @i - 1 { | |
| $second = $first; | |
| $first = @i[^$idx].max; | |
| } else { | |
| $second = @i[($idx+1)..*].max; | |
| } | |
| $total += "$first$second".Int; | |
| print "."; | |
| } | |
| say "\n$total" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment