aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-243/wlmb/blog.txt1
-rwxr-xr-xchallenge-243/wlmb/perl/ch-1.pl14
-rwxr-xr-xchallenge-243/wlmb/perl/ch-2.pl9
3 files changed, 24 insertions, 0 deletions
diff --git a/challenge-243/wlmb/blog.txt b/challenge-243/wlmb/blog.txt
new file mode 100644
index 0000000000..7fc9bcc983
--- /dev/null
+++ b/challenge-243/wlmb/blog.txt
@@ -0,0 +1 @@
+https://wlmb.github.io/2023/11/13/PWC243/
diff --git a/challenge-243/wlmb/perl/ch-1.pl b/challenge-243/wlmb/perl/ch-1.pl
new file mode 100755
index 0000000000..aacc2ff007
--- /dev/null
+++ b/challenge-243/wlmb/perl/ch-1.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 243
+# Task 1: Reverse Pairs
+#
+# See https://wlmb.github.io/2023/11/13/PWC243/#task-1-reverse-pairs
+use v5.36;
+use PDL;
+die <<~"FIN" unless @ARGV;
+ Usage: $0 N1 [N2...]
+ to find how many reversed pairs are in the array N1 N2...
+ FIN
+my $matrix=pdl(@ARGV)->dummy(1,0+@ARGV);
+say "@ARGV ->",
+ (($matrix->xvals < $matrix->yvals) & ($matrix > 2*$matrix->transpose))->sum;
diff --git a/challenge-243/wlmb/perl/ch-2.pl b/challenge-243/wlmb/perl/ch-2.pl
new file mode 100755
index 0000000000..78a1859f85
--- /dev/null
+++ b/challenge-243/wlmb/perl/ch-2.pl
@@ -0,0 +1,9 @@
+#!/usr/bin/env perl
+# Perl weekly challenge 243
+# Task 2: Floor Sum
+#
+# See https://wlmb.github.io/2023/11/13/PWC243/#task-2-floor-sum
+use v5.36;
+use PDL;
+my $in=pdl(@ARGV);
+say "$in -> ", ($in/$in->dummy(0))->floor->sum;