aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-206/feng-chang/raku/ch-1.raku12
-rwxr-xr-xchallenge-206/feng-chang/raku/ch-2.raku5
2 files changed, 17 insertions, 0 deletions
diff --git a/challenge-206/feng-chang/raku/ch-1.raku b/challenge-206/feng-chang/raku/ch-1.raku
new file mode 100755
index 0000000000..d1679698b7
--- /dev/null
+++ b/challenge-206/feng-chang/raku/ch-1.raku
@@ -0,0 +1,12 @@
+#!/bin/env raku
+
+unit sub MAIN(*@T);
+
+my $today = now.Date;
+my $tomorrow = $today.later(days => 1);
+
+my @instants = @T.map({ "{$today.yyyy-mm-dd}T{$_}:00".DateTime });
+@instants.push($_) for @T.map({ "{$tomorrow.yyyy-mm-dd}T{$_}:00".DateTime });
+@instants .= sort;
+
+put (^(+@instants-1)).map({ (@instants[$_+1] - @instants[$_]) / 60 }).min;
diff --git a/challenge-206/feng-chang/raku/ch-2.raku b/challenge-206/feng-chang/raku/ch-2.raku
new file mode 100755
index 0000000000..08056bb905
--- /dev/null
+++ b/challenge-206/feng-chang/raku/ch-2.raku
@@ -0,0 +1,5 @@
+#!/bin/env raku
+
+unit sub MAIN(*@N where +* %% 2);
+
+put @N.sort[0, 2 ... (+@N-2)].sum;