aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-248/wambash/raku/ch-1.raku29
-rw-r--r--challenge-248/wambash/raku/ch-2.raku20
-rw-r--r--challenge-249/arne-sommer/blog.txt1
-rwxr-xr-xchallenge-249/arne-sommer/raku/ch-1.raku28
-rwxr-xr-xchallenge-249/arne-sommer/raku/ch-2.raku25
-rwxr-xr-xchallenge-249/arne-sommer/raku/di-string-match25
-rwxr-xr-xchallenge-249/arne-sommer/raku/equal-pairs28
-rw-r--r--challenge-249/dave-jacoby/blog.txt1
-rw-r--r--challenge-249/dave-jacoby/perl/ch-1.pl38
-rw-r--r--challenge-249/dave-jacoby/perl/ch-2.pl43
-rwxr-xr-xchallenge-249/e-choroba/perl/ch-1.pl75
-rwxr-xr-xchallenge-249/e-choroba/perl/ch-2.pl53
-rwxr-xr-xchallenge-249/e-choroba/python/ch-1.py20
-rwxr-xr-xchallenge-249/e-choroba/python/ch-2.py23
-rwxr-xr-xchallenge-249/eric-cheung/python/ch-1.py16
-rwxr-xr-xchallenge-249/eric-cheung/python/ch-2.py24
-rw-r--r--challenge-249/jeanluc2020/blog-1.txt1
-rw-r--r--challenge-249/jeanluc2020/blog-2.txt1
-rwxr-xr-xchallenge-249/jeanluc2020/perl/ch-1.pl79
-rwxr-xr-xchallenge-249/jeanluc2020/perl/ch-2.pl62
-rwxr-xr-xchallenge-249/jeanluc2020/python/ch-1.py72
-rwxr-xr-xchallenge-249/jeanluc2020/python/ch-2.py59
-rw-r--r--challenge-249/luca-ferrari/blog-1.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-2.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-3.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-4.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-5.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-6.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-7.txt1
-rw-r--r--challenge-249/luca-ferrari/blog-8.txt1
-rw-r--r--challenge-249/luca-ferrari/postgresql/ch-1.plperl30
-rw-r--r--challenge-249/luca-ferrari/postgresql/ch-1.sql40
-rw-r--r--challenge-249/luca-ferrari/postgresql/ch-2.plperl35
-rw-r--r--challenge-249/luca-ferrari/postgresql/ch-2.sql16
-rw-r--r--challenge-249/luca-ferrari/python/ch-1.py34
-rw-r--r--challenge-249/luca-ferrari/python/ch-2.py37
-rw-r--r--challenge-249/luca-ferrari/raku/ch-1.p622
-rw-r--r--challenge-249/luca-ferrari/raku/ch-2.p623
-rw-r--r--challenge-249/mark-anderson/raku/ch-1.raku12
-rw-r--r--challenge-249/mark-anderson/raku/ch-2.raku22
-rw-r--r--challenge-249/packy-anderson/README.md82
-rw-r--r--challenge-249/packy-anderson/blog.txt1
-rwxr-xr-xchallenge-249/packy-anderson/perl/ch-1.pl47
-rwxr-xr-xchallenge-249/packy-anderson/perl/ch-2.pl39
-rwxr-xr-xchallenge-249/packy-anderson/python/ch-1.py47
-rwxr-xr-xchallenge-249/packy-anderson/python/ch-2.py36
-rwxr-xr-xchallenge-249/packy-anderson/raku/ch-1.raku46
-rwxr-xr-xchallenge-249/packy-anderson/raku/ch-2.raku39
-rw-r--r--challenge-249/peter-campbell-smith/blog.txt1
-rwxr-xr-xchallenge-249/peter-campbell-smith/perl/ch-1.pl35
-rwxr-xr-xchallenge-249/peter-campbell-smith/perl/ch-2.pl77
-rwxr-xr-xchallenge-249/peter-meszaros/perl/ch-1.pl68
-rwxr-xr-xchallenge-249/peter-meszaros/perl/ch-2.pl86
-rw-r--r--challenge-249/pokgopun/go/ch-1.go88
-rw-r--r--challenge-249/pokgopun/go/ch-2.go159
-rw-r--r--challenge-249/pokgopun/python/ch-1.py57
-rw-r--r--challenge-249/pokgopun/python/ch-2.py73
-rwxr-xr-xchallenge-249/roger-bell-west/javascript/ch-1.js59
-rwxr-xr-xchallenge-249/roger-bell-west/javascript/ch-2.js71
-rw-r--r--challenge-249/roger-bell-west/kotlin/ch-1.kt32
-rw-r--r--challenge-249/roger-bell-west/kotlin/ch-2.kt45
-rwxr-xr-xchallenge-249/roger-bell-west/lua/ch-1.lua61
-rwxr-xr-xchallenge-249/roger-bell-west/lua/ch-2.lua79
-rwxr-xr-xchallenge-249/roger-bell-west/perl/ch-1.pl25
-rwxr-xr-xchallenge-249/roger-bell-west/perl/ch-2.pl29
-rw-r--r--challenge-249/roger-bell-west/postscript/ch-1.ps215
-rw-r--r--challenge-249/roger-bell-west/postscript/ch-2.ps276
-rwxr-xr-xchallenge-249/roger-bell-west/python/ch-1.py25
-rwxr-xr-xchallenge-249/roger-bell-west/python/ch-2.py35
-rwxr-xr-xchallenge-249/roger-bell-west/raku/ch-1.p623
-rwxr-xr-xchallenge-249/roger-bell-west/raku/ch-2.p627
-rwxr-xr-xchallenge-249/roger-bell-west/ruby/ch-1.rb30
-rwxr-xr-xchallenge-249/roger-bell-west/ruby/ch-2.rb39
-rwxr-xr-xchallenge-249/roger-bell-west/rust/ch-1.rs31
-rwxr-xr-xchallenge-249/roger-bell-west/rust/ch-2.rs39
-rw-r--r--challenge-249/roger-bell-west/scala/ch-1.scala33
-rw-r--r--challenge-249/roger-bell-west/scala/ch-2.scala46
-rw-r--r--challenge-249/roger-bell-west/tests.yaml44
-rw-r--r--challenge-249/steve-g-lynn/blog.txt1
-rwxr-xr-xchallenge-249/steve-g-lynn/perl/ch-1.pl44
-rwxr-xr-xchallenge-249/steve-g-lynn/perl/ch-2.pl32
-rwxr-xr-xchallenge-249/ulrich-rieke/cpp/ch-1.cpp55
-rwxr-xr-xchallenge-249/ulrich-rieke/cpp/ch-2.cpp63
-rwxr-xr-xchallenge-249/ulrich-rieke/haskell/ch-1.hs30
-rwxr-xr-xchallenge-249/ulrich-rieke/haskell/ch-2.hs22
-rwxr-xr-xchallenge-249/ulrich-rieke/perl/ch-1.pl33
-rwxr-xr-xchallenge-249/ulrich-rieke/perl/ch-2.pl45
-rwxr-xr-xchallenge-249/ulrich-rieke/raku/ch-1.raku34
-rwxr-xr-xchallenge-249/ulrich-rieke/raku/ch-2.raku36
-rwxr-xr-xchallenge-249/ulrich-rieke/rust/ch-1.rs30
-rwxr-xr-xchallenge-249/ulrich-rieke/rust/ch-2.rs42
-rw-r--r--challenge-249/zapwai/perl/ch-1.pl23
-rw-r--r--challenge-249/zapwai/perl/ch-2.pl34
-rw-r--r--stats/pwc-challenge-248.json590
-rw-r--r--stats/pwc-current.json396
-rw-r--r--stats/pwc-language-breakdown-summary.json74
-rw-r--r--stats/pwc-language-breakdown.json3387
-rw-r--r--stats/pwc-leaders.json436
-rw-r--r--stats/pwc-summary-1-30.json94
-rw-r--r--stats/pwc-summary-121-150.json108
-rw-r--r--stats/pwc-summary-151-180.json58
-rw-r--r--stats/pwc-summary-181-210.json112
-rw-r--r--stats/pwc-summary-211-240.json132
-rw-r--r--stats/pwc-summary-241-270.json48
-rw-r--r--stats/pwc-summary-271-300.json104
-rw-r--r--stats/pwc-summary-301-330.json32
-rw-r--r--stats/pwc-summary-31-60.json86
-rw-r--r--stats/pwc-summary-61-90.json114
-rw-r--r--stats/pwc-summary-91-120.json44
-rw-r--r--stats/pwc-summary.json724
110 files changed, 7150 insertions, 3160 deletions
diff --git a/challenge-248/wambash/raku/ch-1.raku b/challenge-248/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..ca7faf8cb0
--- /dev/null
+++ b/challenge-248/wambash/raku/ch-1.raku
@@ -0,0 +1,29 @@
+#!/usr/bin/env raku
+
+sub shortest-distance-index ($index, $str, $char) {
+ $str
+ andthen .indices: $char
+ andthen .map: { abs $_ - $index }\
+ andthen .min
+}
+
+sub shortest-distance ($str, $char) {
+ my $length = $str.chars;
+
+ ^$length .map: *.&shortest-distance-index: $str, $char
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is shortest-distance-index(3,'loveleetcode','l'), 1;
+ is shortest-distance-index(1,'loveleetcode','l'), 1;
+ is shortest-distance-index(0,'loveleetcode','c'), 8;
+ is shortest-distance-index(11,'loveleetcode','c'), 3;
+ is shortest-distance('loveleetcode','e'), (3,2,1,0,1,0,0,1,2,2,1,0);
+ is shortest-distance('aaab','b'), (3,2,1,0);
+ done-testing;
+}
+
+multi MAIN ($str, $char) {
+ say shortest-distance $str, $char
+}
diff --git a/challenge-248/wambash/raku/ch-2.raku b/challenge-248/wambash/raku/ch-2.raku
new file mode 100644
index 0000000000..acd7ab5310
--- /dev/null
+++ b/challenge-248/wambash/raku/ch-2.raku
@@ -0,0 +1,20 @@
+#!/usr/bin/env raku
+
+
+sub submatrix-sum (+a) {
+ a
+ andthen .map: *.rotor( 2 => -1 ).map: *.sum
+ andthen .rotor: 2 => -1
+ andthen .map: -> (@f, @s) { @f Z+ @s }
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ cmp-ok submatrix-sum((1...12).rotor(4)), &[~~], ((14,18,22),(30,34,38));
+ cmp-ok submatrix-sum((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)), &[~~], ((2,1,0),(1,2,1),(0,1,2));
+ done-testing;
+}
+
+multi MAIN (+a) {
+ say submatrix-sum +a
+}
diff --git a/challenge-249/arne-sommer/blog.txt b/challenge-249/arne-sommer/blog.txt
new file mode 100644
index 0000000000..9c3ec53f8a
--- /dev/null
+++ b/challenge-249/arne-sommer/blog.txt
@@ -0,0 +1 @@
+https://raku-musings.com/equal-di.html
diff --git a/challenge-249/arne-sommer/raku/ch-1.raku b/challenge-249/arne-sommer/raku/ch-1.raku
new file mode 100755
index 0000000000..96989560ee
--- /dev/null
+++ b/challenge-249/arne-sommer/raku/ch-1.raku
@@ -0,0 +1,28 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@ints where @ints.elems %% 2 && @ints.elems > 0 && all(@ints) ~~ Int, :v(:$verbose));
+
+my @output;
+my @sorted = @ints>>.Int.sort;
+
+say ":Sorted: { @sorted.join(",") }" if $verbose;
+
+while @sorted
+{
+ my $first = @sorted.shift;
+ my $second = @sorted.shift;
+
+ if $first == $second
+ {
+ @output.push: ($first, $second);
+ say ":Pair: $first,$second" if $verbose;
+ }
+ else
+ {
+ say ":Non-pair: $first,$second" if $verbose;
+ say "()";
+ exit;
+ }
+}
+
+say @output.map({ "($_[0], $_[1])"}).join(", ");
diff --git a/challenge-249/arne-sommer/raku/ch-2.raku b/challenge-249/arne-sommer/raku/ch-2.raku
new file mode 100755
index 0000000000..9f90401bc1
--- /dev/null
+++ b/challenge-249/arne-sommer/raku/ch-2.raku
@@ -0,0 +1,25 @@
+#! /usr/bin/env raku
+
+unit sub MAIN ($s where $s ~~ /^<[ID]>+$/, :v(:$verbose));
+
+my @output;
+my @integers = (0 .. $s.chars);
+
+for $s.comb -> $char
+{
+ if $char eq "I"
+ {
+ @output.push: @integers.shift;
+ say ":I -> lowest integer { @output.tail }" if $verbose;
+ }
+ else
+ {
+ @output.push: @integers.pop;
+ say ":D -> highest integer { @output.tail }" if $verbose;
+ }
+}
+
+@output.push: @integers[0];
+say ": -> remaining integer { @output.tail }" if $verbose;
+
+say "({ @output.join(", ") })";
diff --git a/challenge-249/arne-sommer/raku/di-string-match b/challenge-249/arne-sommer/raku/di-string-match
new file mode 100755
index 0000000000..9f90401bc1
--- /dev/null
+++ b/challenge-249/arne-sommer/raku/di-string-match
@@ -0,0 +1,25 @@
+#! /usr/bin/env raku
+
+unit sub MAIN ($s where $s ~~ /^<[ID]>+$/, :v(:$verbose));
+
+my @output;
+my @integers = (0 .. $s.chars);
+
+for $s.comb -> $char
+{
+ if $char eq "I"
+ {
+ @output.push: @integers.shift;
+ say ":I -> lowest integer { @output.tail }" if $verbose;
+ }
+ else
+ {
+ @output.push: @integers.pop;
+ say ":D -> highest integer { @output.tail }" if $verbose;
+ }
+}
+
+@output.push: @integers[0];
+say ": -> remaining integer { @output.tail }" if $verbose;
+
+say "({ @output.join(", ") })";
diff --git a/challenge-249/arne-sommer/raku/equal-pairs b/challenge-249/arne-sommer/raku/equal-pairs
new file mode 100755
index 0000000000..96989560ee
--- /dev/null
+++ b/challenge-249/arne-sommer/raku/equal-pairs
@@ -0,0 +1,28 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@ints where @ints.elems %% 2 && @ints.elems > 0 && all(@ints) ~~ Int, :v(:$verbose));
+
+my @output;
+my @sorted = @ints>>.Int.sort;
+
+say ":Sorted: { @sorted.join(",") }" if $verbose;
+
+while @sorted
+{
+ my $first = @sorted.shift;
+ my $second = @sorted.shift;
+
+ if $first == $second
+ {
+ @output.push: ($first, $second);
+ say ":Pair: $first,$second" if $verbose;
+ }
+ else
+ {
+ say ":Non-pair: $first,$second" if $verbose;
+ say "()";