diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-09-23 16:43:04 +0100 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-09-23 16:43:04 +0100 |
| commit | 5e8f04914943ac3a673d64d31ef0dfdec912a0bb (patch) | |
| tree | b35ddc67e10da5ae6fc6af7032b3d4738444b0b9 | |
| parent | 576fc0a8d1c3d558b66729ad8adc8bbad12c5005 (diff) | |
| download | perlweeklychallenge-club-5e8f04914943ac3a673d64d31ef0dfdec912a0bb.tar.gz perlweeklychallenge-club-5e8f04914943ac3a673d64d31ef0dfdec912a0bb.tar.bz2 perlweeklychallenge-club-5e8f04914943ac3a673d64d31ef0dfdec912a0bb.zip | |
- Added solutions by Laurent Rosenfeld.
- Added solutions by Andre Ploger.
27 files changed, 2595 insertions, 2512 deletions
diff --git a/challenge-288/laurent-rosenfeld/blog.txt b/challenge-288/laurent-rosenfeld/blog.txt new file mode 100644 index 0000000000..e3b16725c7 --- /dev/null +++ b/challenge-288/laurent-rosenfeld/blog.txt @@ -0,0 +1 @@ +https://blogs.perl.org/users/laurent_r/2024/09/perl-weekly-challenge-288-closest-palindrome.html diff --git a/challenge-288/laurent-rosenfeld/perl/ch-1.pl b/challenge-288/laurent-rosenfeld/perl/ch-1.pl new file mode 100644 index 0000000000..d2d709a504 --- /dev/null +++ b/challenge-288/laurent-rosenfeld/perl/ch-1.pl @@ -0,0 +1,19 @@ +use strict; +use warnings; +use feature 'say'; + +sub closest_palindrome { + my $in = shift; + my $i = 1; + while (1) { + return $in - $i if reverse($in - $i) eq $in - $i; + return $in + $i if reverse($in + $i) eq $in + $i; + $i++; + } +} + +my @tests = (123, 2, 1400, 1001); +for my $test (@tests) { + printf "%-6d => ", $test; + say closest_palindrome $test; +} diff --git a/challenge-288/laurent-rosenfeld/raku/ch-1.raku b/challenge-288/laurent-rosenfeld/raku/ch-1.raku new file mode 100644 index 0000000000..c00c271c2a --- /dev/null +++ b/challenge-288/laurent-rosenfeld/raku/ch-1.raku @@ -0,0 +1,12 @@ +sub closest-palindrome ($in) { + for 1..Inf -> $i { + return $in - $i if ($in - $i).flip eq $in - $i; + return $in + $i if ($in + $i).flip eq $in + $i; + } +} + +my @tests = 123, 2, 1400, 1001; +for @tests -> $test { + printf "%-6d => ", $test; + say closest-palindrome $test; +} diff --git a/members.json b/members.json index 8186399b61..ad6e32cc5c 100644 --- a/members.json +++ b/members.json @@ -17,6 +17,7 @@ "andinus" : "Andinus", "andreas-voegele" : "Andreas Voegele", "andrew_mehta" : "Andrew Mehta", + "aplgr" : "Andre Ploger", "asherbhs" : "Asher Harvey-Smith", "atschneid" : "Andrew Schneider", "augiedb" : "Augie De Blieck Jr.", diff --git a/stats/pwc-challenge-287.json b/stats/pwc-challenge-287.json index 50bbf3da6f..945d6cd4ff 100644 --- a/stats/pwc-challenge-287.json +++ b/stats/pwc-challenge-287.json @@ -1,21 +1,21 @@ { - "subtitle" : { - "text" : "[Champions: 31] Last updated at 2024-09-23 14:42:09 GMT" - }, "series" : [ { - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 287", "data" : [ { - "name" : "Andrew Schneider", - "drilldown" : "Andrew Schneider", + "name" : "Andre Ploger", + "drilldown" : "Andre Ploger", "y" : 3 }, { "y" : 3, + "drilldown" : "Andrew Schneider", + "name" : "Andrew Schneider" + }, + { + "name" : "Arne Sommer", "drilldown" : "Arne Sommer", - "name" : "Arne Sommer" + "y" : 3 }, { "drilldown" : "BarrOff", @@ -28,13 +28,13 @@ "name" : "Bob Lied" }, { - "y" : 2, + "drilldown" : "David Ferrone", "name" : "David Ferrone", - "drilldown" : "David Ferrone" + "y" : 2 }, { - "name" : "E. Choroba", "drilldown" : "E. Choroba", + "name" : "E. Choroba", "y" : 3 }, { @@ -43,14 +43,14 @@ "name" : "Feng Chang" }, { - "y" : 3, "drilldown" : "Jorg Sommrey", - "name" : "Jorg Sommrey" + "name" : "Jorg Sommrey", + "y" : 3 }, { + "y" : 2, "name" : "Kjetil Skotheim", - "drilldown" : "Kjetil Skotheim", - "y" : 2 + "drilldown" : "Kjetil Skotheim" }, { "name" : "Laurent Rosenfeld", @@ -58,19 +58,19 @@ "y" : 6 }, { - "drilldown" : "Lubos Kolouch", "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch", "y" : 2 }, { - "y" : 12, "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" + "name" : "Luca Ferrari", + "y" : 12 }, { - "y" : 2, + "name" : "Mark Anderson", "drilldown" : "Mark Anderson", - "name" : "Mark Anderson" + "y" : 2 }, { "y" : 2, @@ -78,24 +78,24 @@ "drilldown" : "Matthew Neleigh" }, { - "drilldown" : "Matthias Muth", + "y" : 3, "name" : "Matthias Muth", - "y" : 3 + "drilldown" : "Matthias Muth" }, { + "y" : 2, "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke", - "y" : 2 + "drilldown" : "Niels van Dijke" }, { + "y" : 5, "drilldown" : "Packy Anderson", - "name" : "Packy Anderson", - "y" : 5 + "name" : "Packy Anderson" }, { - "y" : 2, "name" : "Paulo Custodio", - "drilldown" : "Paulo Custodio" + "drilldown" : "Paulo Custodio", + "y" : 2 }, { "y" : 3, @@ -103,8 +103,8 @@ "drilldown" : "Peter Campbell Smith" }, { - "drilldown" : "Peter Meszaros", "name" : "Peter Meszaros", + "drilldown" : "Peter Meszaros", "y" : 2 }, { @@ -113,29 +113,29 @@ "drilldown" : "Peter Pentchev" }, { - "drilldown" : "Reinier Maliepaard", + "y" : 2, "name" : "Reinier Maliepaard", - "y" : 2 + "drilldown" : "Reinier Maliepaard" }, { + "y" : 3, "drilldown" : "Robbie Hatley", - "name" : "Robbie Hatley", - "y" : 3 + "name" : "Robbie Hatley" }, { - "y" : 2, "drilldown" : "Robert Ransbottom", - "name" : "Robert Ransbottom" + "name" : "Robert Ransbottom", + "y" : 2 }, { - "y" : 5, + "name" : "Roger Bell_West", "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West" + "y" : 5 }, { - "drilldown" : "Santiago Leyva", + "y" : 2, "name" : "Santiago Leyva", - "y" : 2 + "drilldown" : "Santiago Leyva" }, { "name" : "Simon Green", @@ -143,9 +143,9 @@ "y" : 3 }, { - "drilldown" : "Tim King", + "y" : 1, "name" : "Tim King", - "y" : 1 + "drilldown" : "Tim King" }, { "name" : "Ulrich Rieke", @@ -153,26 +153,39 @@ "y" : 4 }, { - "drilldown" : "W. Luis Mochan", + "y" : 3, "name" : "W. Luis Mochan", - "y" : 3 + "drilldown" : "W. Luis Mochan" }, { - "drilldown" : "Wanderdoc", + "y" : 2, "name" : "Wanderdoc", - "y" : 2 + "drilldown" : "Wanderdoc" } - ] + ], + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 287" } ], "title" : { "text" : "The Weekly Challenge - 287" }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : 0 + }, "drilldown" : { "series" : [ { - "id" : "Andrew Schneider", - "name" : "Andrew Schneider", + "name" : "Andre Ploger", + "id" : "Andre Ploger", "data" : [ [ "Perl", @@ -185,7 +198,20 @@ ] }, { - "name" : "Arne Sommer", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Andrew Schneider", + "id" : "Andrew Schneider" + }, + { "data" : [ [ "Raku", @@ -196,19 +222,21 @@ 1 ] ], - "id" : "Arne Sommer" + "id" : "Arne Sommer", + "name" : "Arne Sommer" }, { - "id" : "BarrOff", - "name" : "BarrOff", "data" : [ [ "Raku", 1 ] - ] + ], + "id" : "BarrOff", + "name" : "BarrOff" }, { + "id" : "Bob Lied", "name" : "Bob Lied", "data" : [ [ @@ -219,21 +247,19 @@ "Blog", 1 ] - ], - "id" : "Bob Lied" + ] }, { + "name" : "David Ferrone", + "id" : "David Ferrone", "data" : [ [ "Perl", 2 ] - ], - "name" : "David Ferrone", - "id" : "David Ferrone" + ] }, { - "name" : "E. Choroba", "data" : [ [ "Perl", @@ -244,17 +270,18 @@ 1 ] ], + "name" : "E. Choroba", "id" : "E. Choroba" }, { - "id" : "Feng Chang", "data" : [ [ "Raku", 2 ] ], - "name" : "Feng Chang" + "name" : "Feng Chang", + "id" : "Feng Chang" }, { "data" : [ @@ -271,16 +298,17 @@ "id" : "Jorg Sommrey" }, { - "id" : "Kjetil Skotheim", "data" : [ [ "Perl", 2 ] ], - "name" : "Kjetil Skotheim" + "name" : "Kjetil Skotheim", + "id" : "Kjetil Skotheim" }, { + "id" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", "data" : [ [ @@ -295,21 +323,19 @@ "Blog", 2 ] - ], - "id" : "Laurent Rosenfeld" + ] }, { + "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ], - "name" : "Lubos Kolouch", - "id" : "Lubos Kolouch" + ] }, { - "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -320,30 +346,32 @@ 10 ] ], - "name" : "Luca Ferrari" + "name" : "Luca Ferrari", + "id" : "Luca Ferrari" }, { - "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "id" : "Mark Anderson" + "id" : "Mark Anderson", + "name" : "Mark Anderson" }, { + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] - ], - "name" : "Matthew Neleigh", - "id" : "Matthew Neleigh" + ] }, { "id" : "Matthias Muth", + "name" : "Matthias Muth", "data" : [ [ "Perl", @@ -353,20 +381,20 @@ "Blog", 1 ] - ], - "name" : "Matthias Muth" + ] }, { + "name" : "Niels van Dijke", "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ], - "name" : "Niels van Dijke" + ] }, { + "name" : "Packy Anderson", "id" : "Packy Anderson", "data" : [ [ @@ -381,8 +409,7 @@ "Blog", 1 ] - ], - "name" : "Packy Anderson" + ] }, { "data" : [ @@ -395,6 +422,7 @@ "id" : "Paulo Custodio" }, { + "id" : "Peter Campbell Smith", "name" : "Peter Campbell Smith", "data" : [ [ @@ -405,8 +433,7 @@ "Blog", 1 ] - ], - "id" : "Peter Campbell Smith" + ] }, { "data" : [ @@ -419,8 +446,6 @@ "id" : "Peter Meszaros" }, { - "id" : "Peter Pentchev", - "name" : "Peter Pentchev", "data" : [ [ "Perl", @@ -434,10 +459,11 @@ "Blog", 1 ] - ] + ], + "name" : "Peter Pentchev", + "id" : "Peter Pentchev" }, { - "name" : "Reinier Maliepaard", "data" : [ [ "Perl", @@ -448,9 +474,11 @@ 1 ] ], + "name" : "Reinier Maliepaard", "id" : "Reinier Maliepaard" }, { + "id" : "Robbie Hatley", "name" : "Robbie Hatley", "data" : [ [ @@ -461,22 +489,21 @@ "Blog", 1 ] - ], - "id" : "Robbie Hatley" + ] }, { + "id" : "Robert Ransbottom", + "name" : "Robert Ransbottom", "data" : [ [ "Raku", 2 ] - ], - "name" : "Robert Ransbottom", - "id" : "Robert Ransbottom" + ] }, { - "id" : "Roger Bell_West", "name" : "Roger Bell_West", + "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -499,11 +526,10 @@ 2 ] ], - "name" : "Santiago Leyva", - "id" : "Santiago Leyva" + "id" : "Santiago Leyva", + "name" : "Santiago Leyva" }, { - "name" : "Simon Green", "data" : [ [ "Perl", @@ -514,20 +540,20 @@ 1 ] ], + "name" : "Simon Green", "id" : "Simon Green" }, { - "name" : "Tim King", "data" : [ [ "Perl", 1 ] ], + "name" : "Tim King", "id" : "Tim King" }, { - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -538,7 +564,8 @@ 2 ] ], - "id" : "Ulrich Rieke" + "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke" }, { "data" : [ @@ -555,43 +582,35 @@ "id" : "W. Luis Mochan" }, { + "name" : "Wanderdoc", "id" : "Wanderdoc", "data" : [ [ "Perl", 2 ] - ], - "name" : "Wanderdoc" + ] } ] }, - "legend" : { - "enabled" : 0 + "chart" : { + "type" : "column" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "subtitle" : { + "text" : "[Champions: 32] Last updated at 2024-09-23 15:41:21 GMT" }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { "enabled" : 1, "format" : "{point.y}" - }, - "borderWidth" : 0 + } } }, - "chart" : { - "type" : "column" - }, "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/>", - "followPointer" : 1 - }, - "xAxis" : { - "type" : "category" + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" } } diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 5c71f7ac7e..fd58aa433b 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,71 +1,42 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : 0 - }, - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "The Weekly Challenge - 288" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } - }, - "subtitle" : { - "text" : "[Champions: 3] Last updated at 2024-09-23 14:42:12 GMT" + "tooltip" : { + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "followPointer" : 1, + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" }, - "series" : [ - { - "name" : "The Weekly Challenge - 288", - "colorByPoint" : 1, - "data" : [ - { - "name" : "Feng Chang", - "drilldown" : "Feng Chang", - "y" : 2 - }, - { - "drilldown" : "Lubos Kolouch", - "y" : 2, - "name" : "Lubos Kolouch" - }, - { - "drilldown" : "Luca Ferrari", - "y" : 5, - "name" : "Luca Ferrari" - } - ] - } - ], "drilldown" : { "series" : [ { - "id" : "Feng Chang", + "name" : "Feng Chang", "data" : [ [ "Raku", 2 ] ], - "name" : "Feng Chang" + "id" : "Feng Chang" + }, + { + "id" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Laurent Rosenfeld" }, { - "id" : "Lubos Kolouch", "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch", "data" : [ [ "Perl", @@ -74,6 +45,7 @@ ] }, { + "name" : "Luca Ferrari", "id" : "Luca Ferrari", "data" : [ [ @@ -84,14 +56,65 @@ "Blog", 3 ] - ], - "name" : "Luca Ferrari" + ] } ] }, - "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/>" + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "chart" : { + "type" : "column" + }, + "series" : [ + { + "data" : [ + { + "drilldown" : "Feng Chang", + "name" : "Feng Chang", + "y" : 2 + }, + { + "name" : "Laurent Rosenfeld", + "drilldown" : "Laurent Rosenfeld", + "y" : 3 + }, + { + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "y" : 2 + }, + { + "y" : 5, + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari" + } + ], + "name" : "The Weekly Challenge - 288", + "colorByPoint" : 1 + } + ], + "subtitle" : { + "text" : "[Champions: 4] Last updated at 2024-09-23 15:41:58 GMT" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "title" : { + "text" : "The Weekly Challenge - 288" + }, + "legend" : { + "enabled" : 0 + }, + "xAxis" : { + "type" : "category" } } diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json index fbd646ff34..e762164cee 100644 --- a/stats/pwc-language-breakdown-2019.json +++ b/stats/pwc-language-breakdown-2019.json @@ -1,26 +1,9 @@ { - "title" : { - "text" : "The Weekly Challenge Language" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, - "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" - }, "drilldown" : { "series" : [ { - "id" : "041", "name" : "041", + "id" : "041", "data" : [ [ "Perl", @@ -37,7 +20,6 @@ ] }, { - "id" : "040", "name" : "040", "data" : [ [ @@ -52,11 +34,11 @@ "Blog", 10 ] - ] + ], + "id" : "040" }, { "id" : "039", - "name" : "039", "data" : [ [ "Perl", @@ -70,9 +52,11 @@ "Blog", 12 ] - ] + ], + "name" : "039" }, { + "id" : "038", "data" : [ [ "Perl", @@ -87,12 +71,9 @@ 12 ] ], - "name" : "038", - "id" : "038" + "name" : "038" }, { - "id" : "037", - "name" : "037", "data" : [ [ |
