aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-10-20 03:33:11 +0100
committerGitHub <noreply@github.com>2020-10-20 03:33:11 +0100
commit00c90e6023b59c469174e201366bc71893ffc47d (patch)
treee3d3b5d105adaa51dd6f25661c76f6d2ccb15633
parent90bdd7cb7e2da0b17e7884874f062e8d15935cd1 (diff)
parent33b85271f9f0d87082038656cc7b76abf6e0253a (diff)
downloadperlweeklychallenge-club-00c90e6023b59c469174e201366bc71893ffc47d.tar.gz
perlweeklychallenge-club-00c90e6023b59c469174e201366bc71893ffc47d.tar.bz2
perlweeklychallenge-club-00c90e6023b59c469174e201366bc71893ffc47d.zip
Merge pull request #2572 from holli-holzer/master
initial
-rw-r--r--challenge-083/markus-holzer/raku/ch-1.raku2
-rw-r--r--challenge-083/markus-holzer/raku/ch-2.raku12
2 files changed, 14 insertions, 0 deletions
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
+