diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-07-14 06:05:58 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-07-14 06:05:58 +0100 |
| commit | e9b62f140e6c30616f4b162c85474ac45cff3841 (patch) | |
| tree | 6ee9ce2f17ad2d272b5882f6455b6912be6bb0f8 | |
| parent | d6aadc07aa7c9747681edd9f64958539ba3c012b (diff) | |
| download | perlweeklychallenge-club-e9b62f140e6c30616f4b162c85474ac45cff3841.tar.gz perlweeklychallenge-club-e9b62f140e6c30616f4b162c85474ac45cff3841.tar.bz2 perlweeklychallenge-club-e9b62f140e6c30616f4b162c85474ac45cff3841.zip | |
- Added solutions by Roger Bell_West.
- Added solutions by PokGoPun.
- Added solutions by Arne Sommer.
- Added solutions by Adam Russell.
- Added solutions by Bob Lied.
- Added solutions by Ali Moradi.
- Added solutions by Laurent Rosenfeld.
21 files changed, 1714 insertions, 1577 deletions
diff --git a/challenge-225/conor-hoekstra/ch-01.apl b/challenge-225/conor-hoekstra/apl/ch-1.apl index e8183e14f1..e8183e14f1 100644 --- a/challenge-225/conor-hoekstra/ch-01.apl +++ b/challenge-225/conor-hoekstra/apl/ch-1.apl diff --git a/challenge-225/conor-hoekstra/ch-02.bqn b/challenge-225/conor-hoekstra/bqn/ch-2.bqn index b6e63254ed..b6e63254ed 100644 --- a/challenge-225/conor-hoekstra/ch-02.bqn +++ b/challenge-225/conor-hoekstra/bqn/ch-2.bqn diff --git a/challenge-225/conor-hoekstra/ch-01.hs b/challenge-225/conor-hoekstra/haskell/ch-1.hs index 0763225b2a..0763225b2a 100644 --- a/challenge-225/conor-hoekstra/ch-01.hs +++ b/challenge-225/conor-hoekstra/haskell/ch-1.hs diff --git a/challenge-225/laurent-rosenfeld/blog1.txt b/challenge-225/laurent-rosenfeld/blog1.txt new file mode 100644 index 0000000000..5e0ce3c638 --- /dev/null +++ b/challenge-225/laurent-rosenfeld/blog1.txt @@ -0,0 +1 @@ +https://blogs.perl.org/users/laurent_r/2023/07/perl-weekly-challenge-225-left-right-sum-diff.html diff --git a/challenge-225/laurent-rosenfeld/perl/ch-2.pl b/challenge-225/laurent-rosenfeld/perl/ch-2.pl new file mode 100644 index 0000000000..97de5d58ec --- /dev/null +++ b/challenge-225/laurent-rosenfeld/perl/ch-2.pl @@ -0,0 +1,19 @@ +use strict; +use warnings; +use feature 'say'; + +sub lrsd { + my @in = @_; + my @l = (0); + push @l, $l[-1] + $in[$_] for 0..$#in-1; + my @r = (0); + push @r, $r[-1] + $in[$_] for reverse 1..$#in; + @r = reverse @r; + return join " ", map { abs ($l[$_] - $r[$_]) } 0..$#l; +} + +my @tests = ([10, 4, 8, 3], [1,], [1, 2, 3, 4, 5] ); +for my $test (@tests) { + printf "%-10s => ", "@$test"; + say lrsd @$test; +} diff --git a/challenge-225/laurent-rosenfeld/raku/ch-2.raku b/challenge-225/laurent-rosenfeld/raku/ch-2.raku new file mode 100644 index 0000000000..f0121ad3e5 --- /dev/null +++ b/challenge-225/laurent-rosenfeld/raku/ch-2.raku @@ -0,0 +1,11 @@ +sub lrsd (@in) { + my @l = (0, [\+] @in[0..@in.end - 1]).flat; + my @r = + (( [\+] @in.reverse[0..@in.end - 1]).reverse, 0).flat; + return map { (@l[$_] - @r[$_]).abs }, 0..@l.end; +} +my @tests = (10, 4, 8, 3), (1,), (1, 2, 3, 4, 5); +for @tests -> @test { + printf "%-10s => ", "@test[]"; + say lrsd @test; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index b1815a7ac8..43d74ddb89 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,4 +1,13 @@ { + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, "yAxis" : { "title" : { "text" : "Total Solutions" @@ -6,124 +15,181 @@ }, "series" : [ { - "name" : "The Weekly Challenge - 225", "colorByPoint" : 1, "data" : [ { - "y" : 2, + "name" : "Adam Russell", + "drilldown" : "Adam Russell", + "y" : 4 + }, + { + "y" : 4, + "drilldown" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { "name" : "Andreas Voegele", + "y" : 2, "drilldown" : "Andreas Voegele" }, { + "y" : 3, + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { "drilldown" : "Avery Adams", "y" : 4, "name" : "Avery Adams" }, { + "name" : "Bob Lied", "y" : 2, + "drilldown" : "Bob Lied" + }, + { "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" + "drilldown" : "Dave Jacoby", + "y" : 2 }, { "y" : 2, - "name" : "David Ferrone", - "drilldown" : "David Ferrone" + "drilldown" : "David Ferrone", + "name" : "David Ferrone" }, { - "drilldown" : "E. Choroba", "name" : "E. Choroba", + "drilldown" : "E. Choroba", "y" : 2 }, { "name" : "Joelle Maslak", - "y" : 2, - "drilldown" : "Joelle Maslak" + "drilldown" : "Joelle Maslak", + "y" : 2 }, { - "drilldown" : "Laurent Rosenfeld", - "y" : 3, - "name" : "Laurent Rosenfeld" + "name" : "Laurent Rosenfeld", + "y" : 6, + "drilldown" : "Laurent Rosenfeld" }, { + "y" : 2, "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch", - "y" : 2 + "name" : "Lubos Kolouch" }, { + "drilldown" : "Luca Ferrari", "y" : 8, - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari" + "name" : "Luca Ferrari" }, { - "y" : 1, "name" : "Mariano Spadaccini", + "y" : 1, "drilldown" : "Mariano Spadaccini" }, { - "drilldown" : "Mark Anderson", "name" : "Mark Anderson", - "y" : 2 + "y" : 2, + "drilldown" : "Mark Anderson" }, { "y" : 3, - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith" + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" }, { + "drilldown" : "PokGoPun", + "y" : 2, + "name" : "PokGoPun" + }, + { + "y" : 3, "drilldown" : "Robbie Hatley", - "name" : "Robbie Hatley", - "y" : 3 + "name" : "Robbie Hatley" }, { - "name" : "Robert DiCicco", "y" : 4, - "drilldown" : "Robert DiCicco" + "drilldown" : "Robert DiCicco", + "name" : "Robert DiCicco" }, { - "drilldown" : "Robert Ransbottom", "y" : 2, + "drilldown" : "Robert Ransbottom", "name" : "Robert Ransbottom" }, { - "name" : "Solathian", + "y" : 4, + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { "y" : 2, - "drilldown" : "Solathian" + "drilldown" : "Solathian", + "name" : "Solathian" }, { - "drilldown" : "Steven Wilson", + "name" : "Steven Wilson", "y" : 1, - "name" : "Steven Wilson" + "drilldown" : "Steven Wilson" }, { - "y" : 4, "name" : "Thomas Kohler", - "drilldown" : "Thomas Kohler" + "drilldown" : "Thomas Kohler", + "y" : 4 }, { "drilldown" : "Ulrich Rieke", - "name" : "Ulrich Rieke", - "y" : 4 + "y" : 4, + "name" : "Ulrich Rieke" }, { - "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "y" : 3, - "name" : "W. Luis Mochan" + "drilldown" : "W. Luis Mochan" } - ] + ], + "name" : "The Weekly Challenge - 225" } ], - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "The Weekly Challenge - 225" + "tooltip" : { + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" }, - "legend" : { - "enabled" : 0 + "chart" : { + "type" : "column" }, "drilldown" : { "series" : [ { + "id" : "Adam Russell", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Adam Russell" + }, + { + "id" : "Ali Moradi", + "name" : "Ali Moradi", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ] + }, + { "id" : "Andreas Voegele", "data" : [ [ @@ -134,8 +200,21 @@ "name" : "Andreas Voegele" }, { + "id" : "Arne Sommer", + "name" : "Arne Sommer", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { "id" : "Avery Adams", - "name" : "Avery Adams", "data" : [ [ "Perl", @@ -145,6 +224,17 @@ "Blog", 2 ] + ], + "name" : "Avery Adams" + }, + { + "id" : "Bob Lied", + "name" : "Bob Lied", + "data" : [ + [ + "Perl", + 2 + ] ] }, { @@ -158,23 +248,23 @@ ] }, { - "id" : "David Ferrone", + "name" : "David Ferrone", "data" : [ [ "Perl", 2 ] ], - "name" : "David Ferrone" + "id" : "David Ferrone" }, { + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "name" : "E. Choroba", "id" : "E. Choroba" }, { @@ -188,35 +278,35 @@ "name" : "Joelle Maslak" }, { + "id" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", "data" : [ [ "Perl", - 1 + 2 ], [ "Raku", - 1 + 2 ], [ "Blog", - 1 + 2 ] - ], - "id" : "Laurent Rosenfeld" + ] }, { - "id" : "Lubos Kolouch", "name" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Lubos Kolouch" }, { - "id" : "Luca Ferrari", + "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -227,30 +317,31 @@ 6 ] ], - "name" : "Luca Ferrari" + "id" : "Luca Ferrari" }, { "id" : "Mariano Spadaccini", + "name" : "Mariano Spadaccini", "data" : [ [ "Perl", 1 ] - ], - "name" : "Mariano Spadaccini" + ] }, { - "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], + "name" : "Mark Anderson", "id" : "Mark Anderson" }, { "id" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -260,10 +351,21 @@ "Blog", 1 ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ] ], - "name" : "Peter Campbell Smith" + "name" : "PokGoPun", + "id" : "PokGoPun" }, { + "id" : "Robbie Hatley", + "name" : "Robbie Hatley", "data" : [ [ "Perl", @@ -273,12 +375,9 @@ "Blog", 1 ] - ], - "name" : "Robbie Hatley", - "id" : "Robbie Hatley" + ] }, { - "id" : "Robert DiCicco", "data" : [ [ "Perl", @@ -289,40 +388,54 @@ 2 ] ], - "name" : "Robert DiCicco" + "name" : "Robert DiCicco", + "id" : "Robert DiCicco" }, { + "id" : "Robert Ransbottom", "name" : "Robert Ransbottom", "data" : [ [ "Raku", 2 ] + ] + }, + { + "name" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] ], - "id" : "Robert Ransbottom" + "id" : "Roger Bell_West" }, { - "name" : "Solathian", "data" : [ [ "Perl", 2 ] ], + "name" : "Solathian", "id" : "Solathian" }, { - "name" : "Steven Wilson", "data" : [ [ "Perl", 1 ] ], + "name" : "Steven Wilson", "id" : "Steven Wilson" }, { - "id" : "Thomas Kohler", "data" : [ [ "Perl", @@ -333,11 +446,10 @@ 2 ] ], - "name" : "Thomas Kohler" + "name" : "Thomas Kohler", + "id" : "Thomas Kohler" }, { - "id" : "Ulrich Rieke", - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -347,10 +459,13 @@ "Raku", 2 ] - ] + ], + "name" : "Ulrich Rieke", + "id" : "Ulrich Rieke" }, { "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -360,29 +475,20 @@ "Blog", 1 ] - ], - "name" : "W. Luis Mochan" + ] } ] }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } + "title" : { + "text" : "The Weekly Challenge - 225" }, "subtitle" : { - "text" : "[Champions: 20] Last updated at 2023-07-13 03:00:10 GMT" + "text" : "[Champions: 26] Last updated at 2023-07-14 05:01:38 GMT" }, - "tooltip" : { - "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" + "legend" : { + "enabled" : 0 }, - "chart" : { - "type" : "column" + "xAxis" : { + "type" : "category" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 2f29c29207..990510a798 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,27 +1,9 @@ { - "subtitle" : { - "text" : "Last updated at 2023-07-13 03:00:10 GMT" - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, "chart" : { "type" : "column" }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - } + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" }, "series" : [ { @@ -29,35 +11,53 @@ "data" : [ [ "Blog", - 3732 + 3736 ], [ "Perl", - 11483 + 11494 ], [ "Raku", - 6612 + 6619 ] ], "dataLabels" : { - "rotation" : -90, - "align" : "right", - "enabled" : "true", + "color" : "#FFFFFF", "y" : 10, + "format" : "{point.y:.0f}", "style" : { "fontSize" : "13px", "fontFamily" : "Verdana, sans-serif" }, - "color" : "#FFFFFF", - "format" : "{point.y:.0f}" + "align" : "right", + "rotation" : -90, + "enabled" : "true" } } ], - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2023]" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } + }, + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + } + }, + "subtitle" : { + "text" : "Last updated at 2023-07-14 05:01:38 GMT" }, "legend" : { "enabled" : "false" + }, + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2023]" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index de2c25c79a..d5f18537bf 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,28 +1,33 @@ { - "chart" : { - "type" : "column" + "title" : { + "text" : "The Weekly Challenge Language" }, - "tooltip" : { - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "followPointer" : "true" + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : "false" }, "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2023-07-13 03:00:10 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2023-07-14 05:01:38 GMT" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "plotOptions" : { "series" : { "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 + "enabled" : 1, + "format" : "{point.y}" } } }, "drilldown" : { "series" : [ { - "id" : "001", "name" : "001", "data" : [ [ @@ -37,7 +42,8 @@ "Blog", 11 ] - ] + ], + "id" : "001" }, { "data" : [ @@ -59,6 +65,7 @@ }, { "id" : "003", + "name" : "003", "data" : [ [ "Perl", @@ -72,11 +79,9 @@ "Blog", 9 ] - ], - "name" : "003" + ] }, { - "id" : "004", "name" : "004", "data" : [ [ @@ -91,10 +96,11 @@ "Blog", 10 ] - ] + ], + "id" : "004" }, { - "name" : "005", + "id" : "005", "data" : [ [ "Perl", @@ -109,10 +115,10 @@ 12 ] ], - "id" : "005" + "name" : "005" }, { - "id" : "006", + "name" : "006", "data" : [ [ "Perl", @@ -127,10 +133,9 @@ 7 ] ], - "name" : "006" + "id" : "006" }, { - "id" : "007", "name" : "007", "data" : [ [ @@ -145,10 +150,10 @@ "Blog", 10 ] - ] + ], + "id" : "007" }, { - "id" : "008", "name" : "008", "data" : [ [ @@ -163,9 +168,11 @@ "Blog", 12 ] - ] + ], + "id" : "008" }, { + "id" : "009", "name" : "009", "data" : [ [ @@ -180,11 +187,9 @@ "Blog", 13 ] - ], - "id" : "009" + ] }, { - "name" : "010", "data" : [ [ "Perl", @@ -199,10 +204,10 @@ 11 ] ], + "name" : "010", "id" : "010" }, { - "id" : "011", "name" : "011", "data" : [ [ @@ -217,10 +222,11 @@ "Blog", 10 ] - ] + ], + "id" : "011" }, { - "name" : "012", + "id" : "012", "data" : [ [ "Perl", @@ -235,7 +241,7 @@ 11 ] ], - "id" : "012" + "name" : "012" }, { "id" : "013", @@ -257,6 +263,7 @@ }, { "id" : "014", + "name" : "014", "data" : [ [ "Perl", @@ -270,11 +277,9 @@ "Blog", 15 ] - ], - "name" : "014" + ] }, { - "name" : "015", "data" : [ [ "Perl", @@ -289,11 +294,11 @@ 15 ] ], + "name" : "015", "id" : "015" }, { "id" : "016", - "name" : "016", "data" : [ [ "Perl", @@ -307,9 +312,11 @@ "Blog", 13 ] - ] + ], + "name" : "016" }, { + "name" : "017", "data" : [ [ "Perl", @@ -324,12 +331,10 @@ 12 ] ], - "name" : "017", "id" : "017" }, { "id" : "018", - "name" : "018", "data" : [ [ "Perl", @@ -343,9 +348,11 @@ "Blog", 14 ] - ] + ], + "name" : "018" }, { + "id" : "019", "name" : "019", "data" : [ [ @@ -360,10 +367,10 @@ "Blog", 13 ] - ], - "id" : "019" + ] }, { + "name" : "020", "data" : [ [ "Perl", @@ -378,10 +385,11 @@ 13 ] ], - "name" : "020", "id" : "020" }, { + "id" : "021", + "name" : "021", "data" : [ [ |
