aboutsummaryrefslogtreecommitdiff
path: root/challenge-080
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-09-29 04:54:11 +0100
committerGitHub <noreply@github.com>2020-09-29 04:54:11 +0100
commit0db66116b2db9cbf7fbf483dcb5ac72cbe1e949f (patch)
tree55d490cd083842bce27177cea6558a9a0db764fe /challenge-080
parent57bdd965fc635f4800a8392312660110c9b5f563 (diff)
parent858ddb0bbe8c9c428431d2337110f99e1fc33c8b (diff)
downloadperlweeklychallenge-club-0db66116b2db9cbf7fbf483dcb5ac72cbe1e949f.tar.gz
perlweeklychallenge-club-0db66116b2db9cbf7fbf483dcb5ac72cbe1e949f.tar.bz2
perlweeklychallenge-club-0db66116b2db9cbf7fbf483dcb5ac72cbe1e949f.zip
Merge pull request #2394 from Scimon/master
Here we go
Diffstat (limited to 'challenge-080')
-rw-r--r--challenge-080/simon-proctor/raku/ch-1.raku11
-rw-r--r--challenge-080/simon-proctor/raku/ch-2.raku13
2 files changed, 24 insertions, 0 deletions
diff --git a/challenge-080/simon-proctor/raku/ch-1.raku b/challenge-080/simon-proctor/raku/ch-1.raku
new file mode 100644
index 0000000000..2b86522724
--- /dev/null
+++ b/challenge-080/simon-proctor/raku/ch-1.raku
@@ -0,0 +1,11 @@
+#!/usr/bin/env raku
+
+use v6;
+
+#| Given a list of integers find the first positive integer not in the list.
+sub MAIN (
+ *@N where { $_.all ~~ Int } #= List of integers
+) {
+ say (1...*).first( * !~~ any(@N) );
+
+}
diff --git a/challenge-080/simon-proctor/raku/ch-2.raku b/challenge-080/simon-proctor/raku/ch-2.raku
new file mode 100644
index 0000000000..8da6fa6e0c
--- /dev/null
+++ b/challenge-080/simon-proctor/raku/ch-2.raku
@@ -0,0 +1,13 @@
+#!/usr/bin/env raku
+
+use v6;
+
+#| Given a list of scores work out how many candies you need given these rules :
+#| a) You must given at least one candy to each candidate.
+#| b) Candidate with higher ranking get more candies than their mmediate neighbors on either side.
+sub MAIN (
+ *@N where { $_.all ~~ Int } #= List of scores
+) {
+ my $max = @N.max + 1;
+ say [+] ($max, |@N, $max).rotor(3 => -2).map( -> ($l, $c, $r ) { [+] ($c > $l, 1, $c > $r ) } )
+}