diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-26 06:28:04 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-26 06:28:04 +0000 |
| commit | d882e9aeb09dc20b5ac45ca745ab97b072a60c0d (patch) | |
| tree | 0a56de06d97ce5f4db691757aa35ebf2493441d8 | |
| parent | 0ea16ba5c3a0e2a2576fd486ee06cb4eaf14324c (diff) | |
| download | perlweeklychallenge-club-d882e9aeb09dc20b5ac45ca745ab97b072a60c0d.tar.gz perlweeklychallenge-club-d882e9aeb09dc20b5ac45ca745ab97b072a60c0d.tar.bz2 perlweeklychallenge-club-d882e9aeb09dc20b5ac45ca745ab97b072a60c0d.zip | |
- Added solutions by Flavio Poletti.
| -rw-r--r-- | challenge-196/polettix/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-196/polettix/blog1.txt | 1 | ||||
| -rw-r--r-- | challenge-196/polettix/perl/ch-1.pl | 21 | ||||
| -rw-r--r-- | challenge-196/polettix/perl/ch-2.pl | 24 | ||||
| -rw-r--r-- | challenge-196/polettix/raku/ch-1.raku | 19 | ||||
| -rw-r--r-- | challenge-196/polettix/raku/ch-2.raku | 19 | ||||
| -rw-r--r-- | stats/pwc-current.json | 499 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 60 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1310 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 730 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 94 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 126 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 108 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 110 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 104 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 616 |
21 files changed, 2140 insertions, 2032 deletions
diff --git a/challenge-196/polettix/blog.txt b/challenge-196/polettix/blog.txt new file mode 100644 index 0000000000..57f2569f1c --- /dev/null +++ b/challenge-196/polettix/blog.txt @@ -0,0 +1 @@ +https://github.polettix.it/ETOOBUSY/2022/12/22/pwc196-pattern-132 diff --git a/challenge-196/polettix/blog1.txt b/challenge-196/polettix/blog1.txt new file mode 100644 index 0000000000..89ba6448bb --- /dev/null +++ b/challenge-196/polettix/blog1.txt @@ -0,0 +1 @@ +https://github.polettix.it/ETOOBUSY/2022/12/23/pwc196-range-list diff --git a/challenge-196/polettix/perl/ch-1.pl b/challenge-196/polettix/perl/ch-1.pl new file mode 100644 index 0000000000..dd27f409a3 --- /dev/null +++ b/challenge-196/polettix/perl/ch-1.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl +use v5.24; +use warnings; +use experimental 'signatures'; +no warnings 'experimental::signatures'; + +my @result = first_pattern132(@ARGV ? @ARGV : (3, 1, 4, 2)); +say "(@result)"; + +sub first_pattern132 (@list) { + for my $low (0 .. (@list - 3)) { + for my $high ($low + 1 .. (@list - 2)) { + next if $list[$high] <= $list[$low] - 1; + for my $mid ($high + 1 .. (@list - 1)) { + return @list[$low, $high, $mid] + if $list[$low] < $list[$mid] && $list[$mid] < $list[$high]; + } + } + } + return; +} diff --git a/challenge-196/polettix/perl/ch-2.pl b/challenge-196/polettix/perl/ch-2.pl new file mode 100644 index 0000000000..3738a1ca54 --- /dev/null +++ b/challenge-196/polettix/perl/ch-2.pl @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +use v5.24; +use warnings; +use experimental 'signatures'; +no warnings 'experimental::signatures'; + +say join ', ', + map { '[' . join(',', $_->@*) . ']'} + range_list(@ARGV ? @ARGV : (1, 3, 4, 5, 7)); + +sub range_list (@array) { + my @retval; + for my $v (@array) { + if (@retval && $retval[-1][1] == $v - 1) { + $retval[-1][1] = $v; + } + else { + pop @retval if @retval && $retval[-1][0] == $retval[-1][1]; + push @retval, [$v, $v]; + } + } + pop @retval if @retval && $retval[-1][0] == $retval[-1][1]; + return @retval; +} diff --git a/challenge-196/polettix/raku/ch-1.raku b/challenge-196/polettix/raku/ch-1.raku new file mode 100644 index 0000000000..adebf1fe40 --- /dev/null +++ b/challenge-196/polettix/raku/ch-1.raku @@ -0,0 +1,19 @@ +#!/usr/bin/env raku +use v6; +sub MAIN (*@args is copy) { + @args = 3, 1, 4, 2 unless @args; + say first-pattern132(@args); +} + +sub first-pattern132 (@list) { + for 0 .. (@list - 3) -> $low { + for $low + 1 .. (@list - 2) -> $high { + next if @list[$high] <= @list[$low] - 1; + for $high + 1 ..^ @list -> $mid { + return @list[$low, $high, $mid] + if @list[$low] < @list[$mid] < @list[$high]; + } + } + } + return (); +} diff --git a/challenge-196/polettix/raku/ch-2.raku b/challenge-196/polettix/raku/ch-2.raku new file mode 100644 index 0000000000..425821b6df --- /dev/null +++ b/challenge-196/polettix/raku/ch-2.raku @@ -0,0 +1,19 @@ +#!/usr/bin/env raku +use v6; +sub MAIN (*@args) { say range-list(@args) } + +sub range-list (@array) { + gather { + my ($begin, $end); + for @array -> $v { + if defined($end) && $end == $v - 1 { + $end = $v; + } + else { + take [$begin, $end] if defined($begin) && $begin < $end; + $begin = $end = $v; + } + } + take [$begin, $end] if defined($begin) && $begin < $end; + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 1c4f6bde70..b3a9b036d2 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,17 +1,204 @@ { + "subtitle" : { + "text" : "[Champions: 32] Last updated at 2022-12-26 06:17:00 GMT" + }, + "series" : [ + { + "data" : [ + { + "name" : "Adam Russell", + "y" : 2, + "drilldown" : "Adam Russell" + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "drilldown" : "Athanasius", + "name" : "Athanasius", + "y" : 4 + }, + { + "drilldown" : "Bob Lied", + "name" : "Bob Lied", + "y" : 2 + }, + { + "drilldown" : "Bruce Gray", + "y" : 2, + "name" : "Bruce Gray" + }, + { + "name" : "Carlos Oliveira", + "y" : 2, + "drilldown" : "Carlos Oliveira" + }, + { + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung", + "y" : 2 + }, + { + "y" : 3, + "name" : "Colin Crain", + "drilldown" : "Colin Crain" + }, + { + "y" : 3, + "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby" + }, + { + "drilldown" : "David Ferrone", + "name" : "David Ferrone", + "y" : 2 + }, + { + "name" : "Duncan C. White", + "y" : 2, + "drilldown" : "Duncan C. White" + }, + { + "y" : 2, + "name" : "E. Choroba", + "drilldown" : "E. Choroba" + }, + { + "y" : 2, + "name" : "Feng Chang", + "drilldown" : "Feng Chang" + }, + { + "name" : "Flavio Poletti", + "y" : 6, + "drilldown" : "Flavio Poletti" + }, + { + "y" : 5, + "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas" + }, + { + "drilldown" : "James Smith", + "y" : 3, + "name" : "James Smith" + }, + { + "y" : 2, + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey" + }, + { + "drilldown" : "Laurent Rosenfeld", + "y" : 5, + "name" : "Laurent Rosenfeld" + }, + { + "y" : 8, + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari" + }, + { + "name" : "Mark Anderson", + "y" : 2, + "drilldown" : "Mark Anderson" + }, + { + "y" : 2, + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke" + }, + { + "y" : 3, + "name" : "Peter Campbell Smith", + "drilldown" : "Peter Campbell Smith" + }, + { + "drilldown" : "Pip Stuart", + "name" : "Pip Stuart", + "y" : 2 + }, + { + "y" : 2, + "name" : "Robbie Hatley", + "drilldown" : "Robbie Hatley" + }, + { + "drilldown" : "Robert DiCicco", + "y" : 1, + "name" : "Robert DiCicco" + }, + { + "drilldown" : "Robert Ransbottom", + "y" : 2, + "name" : "Robert Ransbottom" + }, + { + "name" : "Roger Bell_West", + "y" : 5, + "drilldown" : "Roger Bell_West" + }, + { + "y" : 3, + "name" : "Simon Green", + "drilldown" : "Simon Green" + }, + { + "drilldown" : "Stephen G. Lynn", + "y" : 5, + "name" : "Stephen G. Lynn" + }, + { + "drilldown" : "Thomas Kohler", + "name" : "Thomas Kohler", + "y" : 3 + }, + { + "drilldown" : "Ulrich Rieke", + "y" : 4, + "name" : "Ulrich Rieke" + }, + { + "y" : 3, + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 196", + "colorByPoint" : 1 + } + ], + "legend" : { + "enabled" : 0 + }, + "chart" : { + "type" : "column" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } + }, "drilldown" : { "series" : [ { + "name" : "Adam Russell", "data" : [ [ "Perl", 2 ] ], - "id" : "Adam Russell", - "name" : "Adam Russell" + "id" : "Adam Russell" }, { + "id" : "Arne Sommer", "data" : [ [ "Raku", @@ -22,12 +209,9 @@ 1 ] ], - "name" : "Arne Sommer", - "id" : "Arne Sommer" + "name" : "Arne Sommer" }, { - "id" : "Athanasius", - "name" : "Athanasius", "data" : [ [ "Perl", @@ -37,49 +221,52 @@ "Raku", 2 ] - ] + ], + "name" : "Athanasius", + "id" : "Athanasius" }, { - "name" : "Bob Lied", "id" : "Bob Lied", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Bob Lied" }, { - "name" : "Bruce Gray", "id" : "Bruce Gray", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Bruce Gray" }, { - "name" : "Carlos Oliveira", "id" : "Carlos Oliveira", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Carlos Oliveira" }, { "id" : "Cheok-Yin Fung", - "name" : "Cheok-Yin Fung", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Cheok-Yin Fung" }, { + "id" : "Colin Crain", "data" : [ [ "Perl", @@ -90,10 +277,10 @@ 1 ] ], - "name" : "Colin Crain", - "id" : "Colin Crain" + "name" : "Colin Crain" }, { + "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -104,7 +291,6 @@ 1 ] ], - "name" : "Dave Jacoby", "id" : "Dave Jacoby" }, { @@ -114,41 +300,58 @@ 2 ] ], - "id" : "David Ferrone", - "name" : "David Ferrone" + "name" : "David Ferrone", + "id" : "David Ferrone" }, { - "name" : "Duncan C. White", - "id" : "Duncan C. White", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Duncan C. White", + "id" : "Duncan C. White" }, { + "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "id" : "E. Choroba", "name" : "E. Choroba" }, { "id" : "Feng Chang", - "name" : "Feng Chang", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Feng Chang" + }, + { + "id" : "Flavio Poletti", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Flavio Poletti" }, { - "id" : "Jaldhar H. Vyas", "name" : "Jaldhar H. Vyas", "data" : [ [ @@ -163,9 +366,11 @@ "Blog", 1 ] - ] + ], + "id" : "Jaldhar H. Vyas" }, { + "id" : "James Smith", "data" : [ [ "Perl", @@ -176,7 +381,6 @@ 1 ] ], - "id" : "James Smith", "name" : "James Smith" }, { @@ -190,6 +394,7 @@ ] }, { + "id" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -204,10 +409,10 @@ 1 ] ], - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld" + "name" : "Laurent Rosenfeld" }, { + "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -218,22 +423,21 @@ 6 ] ], - "id" : "Luca Ferrari", "name" : "Luca Ferrari" }, { - "id" : "Mark Anderson", - "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Mark Anderson", + "id" : "Mark Anderson" }, { - "name" : "Niels van Dijke", "id" : "Niels van Dijke", + "name" : "Niels van Dijke", "data" : [ [ "Perl", @@ -242,6 +446,7 @@ ] }, { + "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -252,38 +457,37 @@ 1 ] ], - "name" : "Peter Campbell Smith", "id" : "Peter Campbell Smith" }, { + "id" : "Pip Stuart", "data" : [ [ "Perl", 2 ] ], - "name" : "Pip Stuart", - "id" : "Pip Stuart" + "name" : "Pip Stuart" }, { + "id" : "Robbie Hatley", + "name" : "Robbie Hatley", "data" : [ [ "Perl", 2 ] - ], - "name" : "Robbie Hatley", - "id" : "Robbie Hatley" + ] }, { - "name" : "Robert DiCicco", "id" : "Robert DiCicco", "data" : [ [ "Raku", 1 ] - ] + ], + "name" : "Robert DiCicco" }, { "data" : [ @@ -292,10 +496,11 @@ 2 ] ], - "id" : "Robert Ransbottom", - "name" : "Robert Ransbottom" + "name" : "Robert Ransbottom", + "id" : "Robert Ransbottom" }, { + "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -310,7 +515,6 @@ 1 ] ], - "name" : "Roger Bell_West", "id" : "Roger Bell_West" }, { @@ -324,10 +528,12 @@ 1 ] ], - "id" : "Simon Green", - "name" : "Simon Green" + "name" : "Simon Green", + "id" : "Simon Green" }, { + "id" : "Stephen G. Lynn", + "name" : "Stephen G. Lynn", "data" : [ [ "Perl", @@ -341,9 +547,7 @@ "Blog", 1 ] - ], - "name" : "Stephen G. Lynn", - "id" : "Stephen G. Lynn" + ] }, { "id" : "Thomas Kohler", @@ -374,6 +578,8 @@ "id" : "Ulrich Rieke" }, { + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -383,197 +589,14 @@ "Blog", 1 ] - ], - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan" + ] } ] }, "tooltip" : { - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, - "subtitle" : { - "text" : "[Champions: 31] Last updated at 2022-12-26 01:39:44 GMT" - }, - "legend" : { - "enabled" : 0 - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "Adam Russell", - "name" : "Adam Russell", - "y" : 2 - }, - { - "name" : "Arne Sommer", - "y" : 3, - "drilldown" : "Arne Sommer" - }, - { - "y" : 4, - "name" : "Athanasius", - "drilldown" : "Athanasius" - }, - { - "drilldown" : "Bob Lied", - "name" : "Bob Lied", - "y" : 2 - }, - { - "y" : 2, - "name" : "Bruce Gray", - "drilldown" : "Bruce Gray" - }, - { - "y" : 2, - "name" : "Carlos Oliveira", - "drilldown" : "Carlos Oliveira" - }, - { - "name" : "Cheok-Yin Fung", - "y" : 2, - "drilldown" : "Cheok-Yin Fung" - }, - { - "y" : 3, - "name" : "Colin Crain", - "drilldown" : "Colin Crain" - }, - { - "drilldown" : "Dave Jacoby", - "name" : "Dave Jacoby", - "y" : 3 - }, - { - "drilldown" : "David Ferrone", - "name" : "David Ferrone", - "y" : 2 - }, - { - "name" : "Duncan C. White", - "y" : 2, - "drilldown" : "Duncan C. White" - }, - { - "drilldown" : "E. Choroba", - "y" : 2, - "name" : "E. Choroba" - }, - { - "name" : "Feng Chang", - "y" : 2, - "drilldown" : "Feng Chang" - }, - { - "drilldown" : "Jaldhar H. Vyas", - "y" : 5, - "name" : "Jaldhar H. Vyas" - }, - { - "y" : 3, - "name" : "James Smith", - "drilldown" : "James Smith" - }, - { - "y" : 2, - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey" - }, - { - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld", - "y" : 5 - }, - { - "drilldown" : "Luca Ferrari", - "y" : 8, - "name" : "Luca Ferrari" - }, - { - "drilldown" : "Mark Anderson", - "y" : 2, - "name" : "Mark Anderson" - }, - { - "y" : 2, - "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke" - }, - { - "name" : "Peter Campbell Smith", - "y" : 3, - "drilldown" : "Peter Campbell Smith" - }, - { - "name" : "Pip Stuart", - "y" : 2, - "drilldown" : "Pip Stuart" - }, - { - "name" : "Robbie Hatley", - "y" : 2, - "drilldown" : "Robbie Hatley" - }, - { - "name" : "Robert DiCicco", - "y" : 1, - "drilldown" : "Robert DiCicco" - }, - { - "y" : 2, - "name" : "Robert Ransbottom", - "drilldown" : "Robert Ransbottom" - }, - { - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West", - "y" : 5 - }, - { - "drilldown" : "Simon Green", - "y" : 3, - "name" : "Simon Green" - }, - { - "name" : "Stephen G. Lynn", - "y" : 5, - "drilldown" : "Stephen G. Lynn" - }, - { - "name" : "Thomas Kohler", - "y" : 3, - "drilldown" : "Thomas Kohler" - }, - { - "name" : "Ulrich Rieke", - "y" : 4, - "drilldown" : "Ulrich Rieke" - }, - { - "y" : 3, - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" - } - ], - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 196" - } - ], - "chart" : { - "type" : "column" + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" }, "yAxis" : { "title" : { diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 95cf33e96e..18cf02e7f3 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { - "subtitle" : { - "text" : "Last updated at 2022-12-26 01:39:44 GMT" - }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2022]" }, "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" + }, + "subtitle" : { + "text" : "Last updated at 2022-12-26 06:17:00 GMT" + }, "series" : [ { "dataLabels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "enabled" : "true", "align" : "right", + "format" : "{point.y:.0f}", "rotation" : -90, - "color" : "#FFFFFF", + "enabled" : "true", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, "y" : 10, - "format" : "{point.y:.0f}" + "color" : "#FFFFFF" }, + "name" : "Contributions", "data" : [ [ "Blog", - 3135 + 3137 ], [ "Perl", - 9648 + 9650 ], [ "Raku", - 5782 + 5784 ] - ], - "name" : "Contributions" + ] } ], "legend" : { "enabled" : "false" }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, "chart" : { "type" : "column" - }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 10db92b2c9..8ccea164bc 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -2,23 +2,16 @@ "title" : { "text" : "The Weekly Challenge Language" }, - "xAxis" : { - "type" : "category" - }, "chart" : { "type" : "column" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, "legend" : { "enabled" : "false" }, "series" : [ { "colorByPoint" : "true", + "name" : "The Weekly Challenge Languages", "data" : [ { "drilldown" : "001", @@ -26,14 +19,14 @@ "y" : 161 }, { - |
