diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-11-30 10:28:58 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-11-30 10:28:58 +0000 |
| commit | 7789fcc51b04021484d9cc67f829492bf7ef9825 (patch) | |
| tree | aee75d767d1265ca1cacc521f9f3d99178ef7bc9 | |
| parent | f9c1b391fcb02440aa21a9c3a79866db2ba21ff7 (diff) | |
| download | perlweeklychallenge-club-7789fcc51b04021484d9cc67f829492bf7ef9825.tar.gz perlweeklychallenge-club-7789fcc51b04021484d9cc67f829492bf7ef9825.tar.bz2 perlweeklychallenge-club-7789fcc51b04021484d9cc67f829492bf7ef9825.zip | |
- Added solutions by Laurent Rosenfeld.
| -rw-r--r-- | challenge-193/laurent-rosenfeld/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-193/laurent-rosenfeld/perl/ch-1.sh | 4 | ||||
| -rw-r--r-- | challenge-193/laurent-rosenfeld/perl/ch-2.pl | 26 | ||||
| -rw-r--r-- | challenge-193/laurent-rosenfeld/raku/ch-1.sh | 4 | ||||
| -rw-r--r-- | challenge-193/laurent-rosenfeld/raku/ch-2.raku | 22 | ||||
| -rw-r--r-- | stats/pwc-current.json | 265 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 66 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1306 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 750 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 44 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 28 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 114 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 44 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 94 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 88 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 616 |
20 files changed, 1944 insertions, 1864 deletions
diff --git a/challenge-193/laurent-rosenfeld/blog.txt b/challenge-193/laurent-rosenfeld/blog.txt new file mode 100644 index 0000000000..4e7f8d435c --- /dev/null +++ b/challenge-193/laurent-rosenfeld/blog.txt @@ -0,0 +1 @@ +https://blogs.perl.org/users/laurent_r/2022/11/perl-weekly-challenge-193-binary-string-and-odd-string.html diff --git a/challenge-193/laurent-rosenfeld/perl/ch-1.sh b/challenge-193/laurent-rosenfeld/perl/ch-1.sh new file mode 100644 index 0000000000..43ee800832 --- /dev/null +++ b/challenge-193/laurent-rosenfeld/perl/ch-1.sh @@ -0,0 +1,4 @@ +perl -e 'my $c = shift; printf "%0${c}b ", $_ for 0..(2**$c) - 1' 3 +echo +perl -e 'my $c = shift; printf "%0${c}b ", $_ for 0..(2**$c) - 1' 4 +echo diff --git a/challenge-193/laurent-rosenfeld/perl/ch-2.pl b/challenge-193/laurent-rosenfeld/perl/ch-2.pl new file mode 100644 index 0000000000..9e70361837 --- /dev/null +++ b/challenge-193/laurent-rosenfeld/perl/ch-2.pl @@ -0,0 +1,26 @@ +use strict; +use warnings; +use feature qw/say/; +use Data::Dumper; + +sub diff_array { + my $str = shift; + my @diff; + for my $i (1.. length($str) - 1) { + push @diff, + ord(substr($str, $i, 1)) + - ord(substr($str, $i-1, 1)); + } + return "@diff"; +} + +for my $test ([<adc wzy abc>], [<aaa bob ccc ddd>]) { + my %result; + for my $st (@$test) { + push @{$result{diff_array $st}}, $st; + } + # say Dumper \%result; + for my $k (keys %result) { + say "@$test -> ", @{$result{$k}} if scalar @{$result{$k}} == 1; + } +} diff --git a/challenge-193/laurent-rosenfeld/raku/ch-1.sh b/challenge-193/laurent-rosenfeld/raku/ch-1.sh new file mode 100644 index 0000000000..920b00a45d --- /dev/null +++ b/challenge-193/laurent-rosenfeld/raku/ch-1.sh @@ -0,0 +1,4 @@ +raku -e 'sub MAIN ($n) { printf "%03b ", $_ for 0..2**$n-1; }' 3 +echo +raku -e 'sub MAIN ($n) { printf "%03b ", $_ for 0..2**$n-1; }' 4 +echo diff --git a/challenge-193/laurent-rosenfeld/raku/ch-2.raku b/challenge-193/laurent-rosenfeld/raku/ch-2.raku new file mode 100644 index 0000000000..880992a122 --- /dev/null +++ b/challenge-193/laurent-rosenfeld/raku/ch-2.raku @@ -0,0 +1,22 @@ +my %transco = ("a".."z" Z 0..25).flat; # a => 0, b => 1 ... + +sub diff-array ($str) { + my @diff; + for 1..^$str.chars -> $i { + push @diff, + %transco{substr($str, $i, 1)} + - %transco{substr($str, $i-1, 1)}; + } + return @diff; +} + +for <adc wzy abc>, <aaa bob ccc ddd> -> @test { + my %result; + for @test -> $st { + push %result, (diff-array $st) => $st; + } + # say %result; + for %result.keys -> $k { + say @test, " -> ", %result{$k} if %result{$k}.elems == 1; + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index ce0627c26e..d327926338 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,27 +1,147 @@ { + "subtitle" : { + "text" : "[Champions: 14] Last updated at 2022-11-30 10:22:09 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 193" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "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 + }, + "series" : [ + { + "name" : "The Weekly Challenge - 193", + "colorByPoint" : 1, + "data" : [ + { + "y" : 2, + "name" : "E. Choroba", + "drilldown" : "E. Choroba" + }, + { + "y" : 2, + "name" : "Feng Chang", + "drilldown" : "Feng Chang" + }, + { + "drilldown" : "James Smith", + "y" : 3, + "name" : "James Smith" + }, + { + "drilldown" : "Laurent Rosenfeld", + "y" : 5, + "name" : "Laurent Rosenfeld" + }, + { + "y" : 8, + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson", + "y" : 2 + }, + { + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke", + "y" : 2 + }, + { + "drilldown" : "Olivier Delouya", + "y" : 1, + "name" : "Olivier Delouya" + }, + { + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", + "y" : 3 + }, + { + "y" : 2, + "name" : "Robert DiCicco", + "drilldown" : "Robert DiCicco" + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 4 + }, + { + "drilldown" : "Simon Proctor", + "name" : "Simon Proctor", + "y" : 1 + }, + { + "name" : "Stephen G. Lynn", + "y" : 5, + "drilldown" : "Stephen G. Lynn" + }, + { + "drilldown" : "Thomas Kohler", + "name" : "Thomas Kohler", + "y" : 2 + } + ] + } + ], + "chart" : { + "type" : "column" + }, "legend" : { "enabled" : 0 }, "drilldown" : { "series" : [ { - "name" : "E. Choroba", "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "E. Choroba" }, { "id" : "Feng Chang", - "name" : "Feng Chang", "data" : [ [ "Raku", 2 ] + ], + "name" : "Feng Chang" + }, + { + "name" : "James Smith", + "id" : "James Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] ] }, { @@ -31,14 +151,19 @@ 2 ], [ + "Raku", + 2 + ], + [ "Blog", 1 ] ], - "id" : "James Smith", - "name" : "James Smith" + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" }, { + "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -49,42 +174,41 @@ 6 ] ], - "id" : "Luca Ferrari", - "name" : "Luca Ferrari" + "id" : "Luca Ferrari" }, { "name" : "Mark Anderson", - "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ] + ], + "id" : "Mark Anderson" }, { - "id" : "Niels van Dijke", "name" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Niels van Dijke" }, { + "id" : "Olivier Delouya", "data" : [ [ "Perl", 1 ] ], - "id" : "Olivier Delouya", "name" : "Olivier Delouya" }, { - "id" : "Peter Campbell Smith", "name" : "Peter Campbell Smith", + "id" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -97,6 +221,7 @@ ] }, { + "name" : "Robert DiCicco", "data" : [ [ "Perl", @@ -107,12 +232,10 @@ 1 ] ], - "name" : "Robert DiCicco", "id" : "Robert DiCicco" }, { "id" : "Roger Bell_West", - "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -122,19 +245,21 @@ "Raku", 2 ] - ] + ], + "name" : "Roger Bell_West" }, { + "id" : "Simon Proctor", "data" : [ [ "Raku", 1 ] ], - "name" : "Simon Proctor", - "id" : "Simon Proctor" + "name" : "Simon Proctor" }, { + "id" : "Stephen G. Lynn", "data" : [ [ "Perl", @@ -149,8 +274,7 @@ 1 ] ], - "name" : "Stephen G. Lynn", - "id" : "Stephen G. Lynn" + "name" : "Stephen G. Lynn" }, { "data" : [ @@ -164,107 +288,6 @@ } ] }, - "tooltip" : { - "followPointer" : 1, - "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/>" - }, - "chart" : { - "type" : "column" - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "E. Choroba", - "name" : "E. Choroba", - "y" : 2 - }, - { - "drilldown" : "Feng Chang", - "name" : "Feng Chang", - "y" : 2 - }, - { - "y" : 3, - "drilldown" : "James Smith", - "name" : "James Smith" - }, - { - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari", - "y" : 8 - }, - { - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson", - "y" : 2 - }, - { - "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke", - "y" : 2 - }, - { - "drilldown" : "Olivier Delouya", - "name" : "Olivier Delouya", - "y" : 1 - }, - { - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith", - "y" : 3 - }, - { - "y" : 2, - "drilldown" : "Robert DiCicco", - "name" : "Robert DiCicco" - }, - { - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West", - "y" : 4 - }, - { - "drilldown" : "Simon Proctor", - "name" : "Simon Proctor", - "y" : 1 - }, - { - "name" : "Stephen G. Lynn", - "drilldown" : "Stephen G. Lynn", - "y" : 5 - }, - { - "y" : 2, - "name" : "Thomas Kohler", - "drilldown" : "Thomas Kohler" - } - ], - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 193" - } - ], - "subtitle" : { - "text" : "[Champions: 13] Last updated at 2022-11-30 09:38:26 GMT" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "title" : { - "text" : "The Weekly Challenge - 193" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, "xAxis" : { "type" : "category" } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 6273936e94..dccc565e66 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,62 +1,62 @@ { - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" - }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 - }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2022]" - }, "series" : [ { - "name" : "Contributions", "dataLabels" : { - "y" : 10, "format" : "{point.y:.0f}", + "align" : "right", "enabled" : "true", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, "color" : "#FFFFFF", - "align" : "right", - "rotation" : -90 + "rotation" : -90, + "y" : 10, + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } }, + "name" : "Contributions", "data" : [ [ "Blog", - 3067 + 3068 ], [ "Perl", - 9440 + 9442 ], [ "Raku", - 5677 + 5679 ] ] } ], + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, "subtitle" : { - "text" : "Last updated at 2022-11-30 09:38:26 GMT" + "text" : "Last updated at 2022-11-30 10:22:09 GMT" + }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } + }, + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2022]" + }, + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } }, "legend" : { "enabled" : "false" }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, "chart" : { "type" : "column" } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index f444a9f1d4..5a0d907691 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,34 +1,8 @@ { - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "title" : { - "text" : "The Weekly Challenge Language" - }, - "xAxis" : { - "type" : "category" - }, - "tooltip" : { - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", - "followPointer" : "true" - }, "drilldown" : { "series" : [ { "name" : "001", - "id" : "001", "data" : [ [ "Perl", @@ -42,10 +16,10 @@ "Blog", 11 ] - ] + ], + "id" : "001" }, { - "name" : "002", "id" : "002", "data" : [ [ @@ -60,9 +34,11 @@ "Blog", 10 ] - ] + ], + "name" : "002" }, { + "name" : "003", "data" : [ [ "Perl", @@ -77,12 +53,10 @@ 9 ] ], - "name" : "003", "id" : "003" }, { "name" : "004", - "id" : "004", "data" : [ [ "Perl", @@ -96,7 +70,8 @@ "Blog", 10 ] - ] + ], + "id" : "004" }, { "name" : "005", @@ -117,6 +92,8 @@ ] }, { + "name" : "006", + "id" : "006", "data" : [ [ "Perl", @@ -130,13 +107,9 @@ "Blog", 7 ] - ], - "id" : "006", - "name" : "006" + ] }, { - "id" : "007", - "name" : "007", "data" : [ [ "Perl", @@ -150,9 +123,12 @@ "Blog", 10 ] - ] + ], + "id" : "007", + "name" : "007" }, { + "id" : "008", "data" : [ [ "Perl", @@ -167,10 +143,10 @@ 12 ] ], - "id" : "008", "name" : "008" }, { + "id" : "009", "data" : [ [ "Perl", @@ -185,10 +161,10 @@ 13 ] ], - "id" : "009", "name" : "009" }, { + "id" : "010", "data" : [ [ "Perl", @@ -203,11 +179,9 @@ 11 ] ], - "id" : "010", "name" : "010" }, { - "name" : "011", "id" : "011", "data" : [ [ @@ -222,9 +196,12 @@ "Blog", 10 ] - ] + ], + "name" : "011" }, { + "name" : "012", + "id" : "012", "data" : [ [ "Perl", @@ -238,13 +215,10 @@ "Blog", 11 ] - ], - "id" : "012", - "name" : "012" + ] }, { "name" : "013", - "id" : "013", "data" : [ [ "Perl", @@ -258,11 +232,10 @@ "Blog", 13 ] - ] + ], + "id" : "013" }, { - "name" : "014", - "id" : "014", "data" : [ [ "Perl", @@ -276,7 +249,9 @@ "Blog", 15 ] - ] + ], + "id" : "014", + "name" : "014" }, { "name" : "015", @@ -298,7 +273,6 @@ }, { "name" : "016", - "id" : "016", "data" : [ [ "Perl", @@ -312,9 +286,11 @@ "Blog", 12 ] - ] + ], + "id" : "016" }, { + "name" : "017", "data" : [ [ "Perl", @@ -329,8 +305,7 @@ 12 ] ], - "id" : "017", - "name" : "017" + "id" : "017" }, { "data" : [ @@ -351,8 +326,6 @@ "name" : "018" }, { - "name" : "019", - "id" : "019", "data" : [ [ "Perl", @@ -366,11 +339,13 @@ "Blog", 13 ] - ] + ], + "id" : "019", + "name" : "019" }, { - "id" : "020", "name" : "020", + "id" : "020", "data" : [ [ "Perl", @@ -387,8 +362,6 @@ ] }, { - "name" : "021", - "id" : "021", "data" : [ [ "Perl", @@ -402,9 +375,13 @@ "Blog", 10 ] - ] + ], + "id" : "021", + "name" : "021" }, { + "name" : "022", + "id" : "022", "data" : [ [ "Perl", @@ -418,11 +395,10 @@ "Blog", 10 ] - ], - "id" : "022", - "name" : "022" + ] }, { + "id" : "023", "data" : [ [ "Perl", @@ -437,10 +413,11 @@ 12 ] ], - "id" : "023", "name" : "023" }, { + "name" : "024", + "id" : "024", "data" : [ [ "Perl", @@ -454,11 +431,10 @@ "Blog", 11 ] - ], - "id" : "024", - "name" : "024" + ] }, { + "name" : "025", "data" : [ [ "Perl", @@ -473,10 +449,11 @@ 12 ] ], - "id" : "025", - "name" : "025" + "id" : "025" }, { + "name" : "026", + "id" : "026", "data" : [ [ "Perl", @@ -490,12 +467,9 @@ "Blog", 10 ] - ], - "id" : "026", - "name" : "026" + ] }, { - "id" : "027", "name" : "027", "data" : [ [ @@ -510,9 +484,11 @@ "Blog", 9 ] - ] + ], + "id" : "027" }, { + "name" : "028", "data" : [ [ "Perl", @@ -527,10 +503,10 @@ 9 ] ], - "id" : "028", - "name" : "028" + "id" : "028" }, { + "id" : "029", "data" : [ [ "Perl", @@ -545,7 +521,6 @@ 12 ] ], - "id" : "029", "name" : "029" }, { @@ -567,8 +542,8 @@ "name" : "030" }, { - "id" : "031", "name" : "031", + "id" : "031", "data" : [ [ "Perl", @@ -603,6 +578,7 @@ ] }, { + "id" : "033", "data" : [ [ "Perl", @@ -617,10 +593,10 @@ 10 ] ], - "id" : "033", "name" : "033" }, { + "id" : "034", "data" : [ [ "Perl", @@ -635,12 +611,10 @@ 11 ] ], - "id" : "034", "name" : "034" }, { "id" : "035", - "name" : "035", "data" : [ [ "Perl", @@ -654,11 +628,11 @@ "Blog", 9 ] - ] + ], + "name" : "035" }, { "id" : "036", - "name" : "036", "data" : [ [ "Perl", @@ -672,9 +646,12 @@ "Blog", 11 ] - ] + ], + "name" : "036" }, { + "name" : "037", + "id" : "037", "data" : [ [ "Perl", @@ -688,11 +665,10 @@ "Blog", 9 ] - ], - "id" : "037", - "name" : "037" + ] }, { + "name" : "038", "data" : [< |
