From 7ab9d49b5c4b09440647e714d5b8510a148a4063 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:02:09 +0200 Subject: Solution to task 1 --- challenge-265/jo-37/perl/ch-1.pl | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 challenge-265/jo-37/perl/ch-1.pl (limited to 'challenge-265') diff --git a/challenge-265/jo-37/perl/ch-1.pl b/challenge-265/jo-37/perl/ch-1.pl new file mode 100755 index 0000000000..8f44c31fbb --- /dev/null +++ b/challenge-265/jo-37/perl/ch-1.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; +use List::Util 'reduce'; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die <= 33 && $b < ($a // 'inf') ? $b : $a; + } undef, @_; +} + + +### Examples and tests + +sub run_tests { + SKIP: { + skip "examples" unless $examples; + + is appearance33(1,2,3,3,3,3,4,2), 3, 'example 1'; + is appearance33(1, 1), 1, 'example 2'; + is appearance33(1, 2, 3), 1, 'example 3'; + } + + SKIP: { + skip "tests" unless $tests; + is appearance33((2, 3) x 33, (1) x 34), 1, 'exactly 33%'; + is appearance33((1, 2, 3) x 32, (4) x 4), U(), 'nothing found'; + } + + done_testing; + exit; +} -- cgit From 2eafcc9024af4a1facd5087216b457db5d7ed8cd Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:02:22 +0200 Subject: Solution to task 2 --- challenge-265/jo-37/perl/ch-2.pl | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 challenge-265/jo-37/perl/ch-2.pl (limited to 'challenge-265') diff --git a/challenge-265/jo-37/perl/ch-2.pl b/challenge-265/jo-37/perl/ch-2.pl new file mode 100755 index 0000000000..56929d721f --- /dev/null +++ b/challenge-265/jo-37/perl/ch-2.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl -s + +use v5.24; +use Test2::V0; +use List::AllUtils qw(pairmap min_by count_by); +use experimental 'signatures'; + +our ($tests, $examples); + +run_tests() if $tests || $examples; # does not return + +die < 'accbbb', 'abc', 'abbc'), + 'accbbb', 'example 1'; + is completing_word('Da2 abc' => 'abcm', 'baacd', 'abaadc'), + 'baacd', 'example 2'; + is completing_word('JB 007' => 'jj', 'bb', 'bjb'), + 'bjb', 'example 3'; + } + + SKIP: { + skip "tests" unless $tests; + } + + done_testing; + exit; +} -- cgit From 3c85a17ce532065ffff1f5a3ec3b1c9f10f334b7 Mon Sep 17 00:00:00 2001 From: Jörg Sommrey <28217714+jo-37@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:14:04 +0200 Subject: Blog for challenge 265 --- challenge-265/jo-37/blog.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-265/jo-37/blog.txt (limited to 'challenge-265') diff --git a/challenge-265/jo-37/blog.txt b/challenge-265/jo-37/blog.txt new file mode 100644 index 0000000000..7d586274b8 --- /dev/null +++ b/challenge-265/jo-37/blog.txt @@ -0,0 +1 @@ +https://github.sommrey.de/the-bears-den/2024/04/19/ch-265.html -- cgit