From 33b85271f9f0d87082038656cc7b76abf6e0253a Mon Sep 17 00:00:00 2001 From: "Markus \"Holli\" Holzer" Date: Mon, 19 Oct 2020 18:41:19 +0200 Subject: initial --- challenge-083/markus-holzer/raku/ch-1.raku | 2 ++ challenge-083/markus-holzer/raku/ch-2.raku | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 challenge-083/markus-holzer/raku/ch-1.raku create mode 100644 challenge-083/markus-holzer/raku/ch-2.raku diff --git a/challenge-083/markus-holzer/raku/ch-1.raku b/challenge-083/markus-holzer/raku/ch-1.raku new file mode 100644 index 0000000000..6785656edb --- /dev/null +++ b/challenge-083/markus-holzer/raku/ch-1.raku @@ -0,0 +1,2 @@ +unit sub MAIN( Str $S ); +$S.words[ 1 .. *-2 ].join.chars.say \ No newline at end of file diff --git a/challenge-083/markus-holzer/raku/ch-2.raku b/challenge-083/markus-holzer/raku/ch-2.raku new file mode 100644 index 0000000000..9bc6e3ee33 --- /dev/null +++ b/challenge-083/markus-holzer/raku/ch-2.raku @@ -0,0 +1,12 @@ +unit sub MAIN( *@A ); + +my &neg = *.grep: * < 0; + +say + neg # find and count all negative numbers of + ( [X] map { +$_, -$_ }, @A ) # all possible candidates + .classify( *.sum ) # grouped by sum + .grep( *.key > -1 ) # filtered where sum is positive + .sort( *.key ) # sorted by sum + .head.value # closest to zero + .min( &neg ) # the one with the least flips + -- cgit