diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-06-28 23:18:48 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-06-28 23:18:48 +0100 |
| commit | f05ed371fbf1775223218433692a6103270c5e39 (patch) | |
| tree | 1a96fb9a5af7e5b802fe1c22e667c61dafd199f3 | |
| parent | 07f6dd3877c8c60560c38da0daa544f92972a8ac (diff) | |
| download | perlweeklychallenge-club-f05ed371fbf1775223218433692a6103270c5e39.tar.gz perlweeklychallenge-club-f05ed371fbf1775223218433692a6103270c5e39.tar.bz2 perlweeklychallenge-club-f05ed371fbf1775223218433692a6103270c5e39.zip | |
- Added solutions by Jorg Sommrey.
- Added solutions by Wanderdoc.
| -rwxr-xr-x | challenge-275/wanderdoc/perl/ch-1.pl | 57 | ||||
| -rwxr-xr-x | challenge-275/wanderdoc/perl/ch-2.pl | 79 | ||||
| -rw-r--r-- | stats/pwc-current.json | 394 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 58 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1898 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 464 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 92 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 56 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-301-330.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 104 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 50 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 664 |
18 files changed, 2221 insertions, 2051 deletions
diff --git a/challenge-275/wanderdoc/perl/ch-1.pl b/challenge-275/wanderdoc/perl/ch-1.pl new file mode 100755 index 0000000000..67dc319539 --- /dev/null +++ b/challenge-275/wanderdoc/perl/ch-1.pl @@ -0,0 +1,57 @@ +#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+You are given a sentence, $sentence and list of broken keys @keys.
+
+Write a script to find out how many words can be typed fully.
+Example 1
+
+Input: $sentence = "Perl Weekly Challenge", @keys = ('l', 'a')
+Output: 0
+
+Example 2
+
+Input: $sentence = "Perl and Raku", @keys = ('a')
+Output: 1
+
+Only Perl since the other word two words contain 'a' and can't be typed fully.
+
+Example 3
+
+Input: $sentence = "Well done Team PWC", @keys = ('l', 'o')
+Output: 2
+
+Example 4
+
+Input: $sentence = "The joys of polyglottism", @keys = ('T')
+Output: 2
+
+=cut
+
+use Test2::V0;
+
+is(check_keys(q(Perl Weekly Challenge), [qw(l a)]), 0, q(Example 1));
+is(check_keys(q(Perl and Raku), [qw(a)]), 1, q(Example 2));
+is(check_keys(q(Well done Team PWC), [qw(l o)]), 2, q(Example 3));
+is(check_keys(q(The joys of polyglottism), [qw(T)]), 2, q(Example 4));
+done_testing();
+
+
+
+
+
+sub check_keys
+{
+ my $sentence = $_[0];
+ my $keys_aref = $_[1];
+ my $re_ltr = do { my $ltr_str = join('|', @$keys_aref); qr/$ltr_str/i; };
+ my $counter = 0;
+ for my $word ( split(/\s/, $sentence ) )
+ {
+ next if $word =~ /$re_ltr/;
+ $counter++;
+ }
+ return $counter;
+}
\ No newline at end of file diff --git a/challenge-275/wanderdoc/perl/ch-2.pl b/challenge-275/wanderdoc/perl/ch-2.pl new file mode 100755 index 0000000000..af0926a840 --- /dev/null +++ b/challenge-275/wanderdoc/perl/ch-2.pl @@ -0,0 +1,79 @@ +#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+You are given an alphanumeric string, $str, where each character is either a letter or a digit.
+
+Write a script to replace each digit in the given string with the value of the previous letter plus (digit) places.
+Example 1
+
+Input: $str = 'a1c1e1'
+Ouput: 'abcdef'
+
+shift('a', 1) => 'b'
+shift('c', 1) => 'd'
+shift('e', 1) => 'f'
+
+Example 2
+
+Input: $str = 'a1b2c3d4'
+Output: 'abbdcfdh'
+
+shift('a', 1) => 'b'
+shift('b', 2) => 'd'
+shift('c', 3) => 'f'
+shift('d', 4) => 'h'
+
+Example 3
+
+Input: $str = 'b2b'
+Output: 'bdb'
+
+Example 4
+
+Input: $str = 'a16z'
+Output: 'abgz'
+
+=cut
+
+
+use List::MoreUtils qw(first_index);
+use Test2::V0;
+
+is(replace_digits(q(a1c1e1)), q(abcdef), q(Example 1));
+is(replace_digits(q(a1b2c3d4)), q(abbdcfdh), q(Example 2));
+is(replace_digits(q(b2b)), q(bdb), q(Example 3));
+is(replace_digits(q(a16z)), q(abgz), q(Example 4));
+done_testing();
+
+sub replace_digits
+{
+ my $str = $_[0];
+ my @letters = 'a' .. 'z';
+ my $re_ltr = do { my $ltr_str = join('|', @letters); qr/$ltr_str/; };
+ my $re_num = do { my $num_str = join('|', 0 .. 9 ); qr/$num_str/; };
+ my @arr = split(//, $str);
+ my $this_letter;
+ for my $elm ( @arr )
+ {
+ if ($elm =~ /$re_ltr/)
+ {
+ $this_letter = $elm;
+ }
+ elsif ( $elm =~ /$re_num/)
+ {
+ if ( defined $this_letter )
+ {
+ my $idx = first_index { $_ eq $this_letter } @letters;
+ $idx += $elm;
+ $elm = $letters[$idx];
+ }
+ else
+ {
+ die "The first character must be a letter a .. z!$/";
+ }
+ }
+ }
+ return join('', @arr);
+}
\ No newline at end of file diff --git a/stats/pwc-current.json b/stats/pwc-current.json index b9497926a0..3ae1365785 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,9 +1,159 @@ { + "legend" : { + "enabled" : 0 + }, + "xAxis" : { + "type" : "category" + }, + "subtitle" : { + "text" : "[Champions: 22] Last updated at 2024-06-28 22:11:13 GMT" + }, + "series" : [ + { + "name" : "The Weekly Challenge - 275", + "data" : [ + { + "y" : 3, + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { + "y" : 4, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "y" : 2, + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { + "name" : "David Ferrone", + "drilldown" : "David Ferrone", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "y" : 2, + "drilldown" : "Feng Chang", + "name" : "Feng Chang" + }, + { + "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas", + "y" : 5 + }, + { + "name" : "Joelle Maslak", + "drilldown" : "Joelle Maslak", + "y" : 4 + }, + { + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "y" : 3 + }, + { + "y" : 11, + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson", + "y" : 2 + }, + { + "drilldown" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "y" : 2 + }, + { + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke", + "y" : 2 + }, + { + "name" : "Packy Anderson", + "drilldown" : "Packy Anderson", + "y" : 5 + }, + { + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", + "y" : 3 + }, + { + "y" : 2, + "drilldown" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "y" : 3, + "name" : "Reinier Maliepaard", + "drilldown" : "Reinier Maliepaard" + }, + { + "drilldown" : "Robbie Hatley", + "name" : "Robbie Hatley", + "y" : 3 + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 4 + }, + { + "y" : 4, + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler" + }, + { + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan", + "y" : 3 + }, + { + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc", + "y" : 2 + } + ], + "colorByPoint" : 1 + } + ], + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "title" : { + "text" : "The Weekly Challenge - 275" + }, + "tooltip" : { + "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 + }, + "chart" : { + "type" : "column" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } + }, "drilldown" : { "series" : [ { - "id" : "Arne Sommer", - "name" : "Arne Sommer", "data" : [ [ "Raku", @@ -13,10 +163,11 @@ "Blog", 1 ] - ] + ], + "name" : "Arne Sommer", + "id" : "Arne Sommer" }, { - "id" : "Athanasius", "name" : "Athanasius", "data" : [ [ @@ -27,7 +178,8 @@ "Raku", 2 ] - ] + ], + "id" : "Athanasius" }, { "data" : [ @@ -40,37 +192,36 @@ "id" : "Dave Jacoby" }, { - "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" }, { - "name" : "Feng Chang", "id" : "Feng Chang", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Feng Chang" }, { - "id" : "Jaldhar H. Vyas", "name" : "Jaldhar H. Vyas", "data" : [ [ @@ -85,11 +236,11 @@ "Blog", 1 ] - ] + ], + "id" : "Jaldhar H. Vyas" }, { "name" : "Joelle Maslak", - "id" : "Joelle Maslak", "data" : [ [ "Perl", @@ -99,11 +250,24 @@ "Raku", 2 ] - ] + ], + "id" : "Joelle Maslak" + }, + { + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Jorg Sommrey" }, { - "name" : "Luca Ferrari", - "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -113,27 +277,29 @@ "Blog", 9 ] - ] + ], + "name" : "Luca Ferrari", + "id" : "Luca Ferrari" }, { + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson", "id" : "Mark Anderson" }, { - "name" : "Matthew Neleigh", "id" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Matthew Neleigh" }, { "data" : [ @@ -142,11 +308,10 @@ 2 ] ], - "id" : "Niels van Dijke", - "name" : "Niels van Dijke" + "name" : "Niels van Dijke", + "id" : "Niels van Dijke" }, { - "name" : "Packy Anderson", "id" : "Packy Anderson", "data" : [ [ @@ -161,7 +326,8 @@ "Blog", 1 ] - ] + ], + "name" : "Packy Anderson" }, { "data" : [ @@ -184,12 +350,10 @@ 2 ] ], - "id" : "Peter Meszaros", - "name" : "Peter Meszaros" + "name" : "Peter Meszaros", + "id" : "Peter Meszaros" }, { - "id" : "Reinier Maliepaard", - "name" : "Reinier Maliepaard", "data" : [ [ "Perl", @@ -199,11 +363,13 @@ "Blog", 1 ] - ] + ], + "name" : "Reinier Maliepaard", + "id" : "Reinier Maliepaard" }, { - "name" : "Robbie Hatley", "id" : "Robbie Hatley", + "name" : "Robbie Hatley", "data" : [ [ "Perl", @@ -216,6 +382,8 @@ ] }, { + "id" : "Roger Bell_West", + "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -225,11 +393,11 @@ "Raku", 2 ] - ], - "id" : "Roger Bell_West", - "name" : "Roger Bell_West" + ] }, { + "id" : "Thomas Kohler", + "name" : "Thomas Kohler", "data" : [ [ "Perl", @@ -239,13 +407,10 @@ "Blog", 2 ] - ], - "id" : "Thomas Kohler", - "name" : "Thomas Kohler" + ] }, { "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -255,150 +420,19 @@ "Blog", 1 ] + ], + "name" : "W. Luis Mochan" + }, + { + "id" : "Wanderdoc", + "name" : "Wanderdoc", + "data" : [ + [ + "Perl", + 2 + ] ] } ] - }, - "xAxis" : { - "type" : "category" - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "The Weekly Challenge - 275" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, - "chart" : { - "type" : "column" - }, - "series" : [ - { - "data" : [ - { - "name" : "Arne Sommer", - "drilldown" : "Arne Sommer", - "y" : 3 - }, - { - "name" : "Athanasius", - "y" : 4, - "drilldown" : "Athanasius" - }, - { - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby", - "y" : 2 - }, - { - "name" : "David Ferrone", - "drilldown" : "David Ferrone", - "y" : 2 - }, - { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "name" : "Feng Chang", - "y" : 2, - "drilldown" : "Feng Chang" - }, - { - "drilldown" : "Jaldhar H. Vyas", - "y" : 5, - "name" : "Jaldhar H. Vyas" - }, - { - "name" : "Joelle Maslak", - "y" : 4, - "drilldown" : "Joelle Maslak" - }, - { - "y" : 11, - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" - }, - { - "y" : 2, - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson" - }, - { - "y" : 2, - "drilldown" : "Matthew Neleigh", - "name" : "Matthew Neleigh" - }, - { - "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke", - "y" : 2 - }, - { - "drilldown" : "Packy Anderson", - "y" : 5, - "name" : "Packy Anderson" - }, - { - "name" : "Peter Campbell Smith", - "y" : 3, - "drilldown" : "Peter Campbell Smith" - }, - { - "name" : "Peter Meszaros", - "drilldown" : "Peter Meszaros", - "y" : 2 - }, - { - "name" : "Reinier Maliepaard", - "drilldown" : "Reinier Maliepaard", - "y" : 3 - }, - { - "drilldown" : "Robbie Hatley", - "y" : 3, - "name" : "Robbie Hatley" - }, - { - "drilldown" : "Roger Bell_West", - "y" : 4, - "name" : "Roger Bell_West" - }, - { - "drilldown" : "Thomas Kohler", - "y" : 4, - "name" : "Thomas Kohler" - }, - { - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan", - "y" : 3 - } - ], - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 275" - } - ], - "subtitle" : { - "text" : "[Champions: 20] Last updated at 2024-06-27 09:39:19 GMT" - }, - "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/>" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index fd6f200d20..f1626bbfac 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { + "legend" : { + "enabled" : "false" + }, + "subtitle" : { + "text" : "Last updated at 2024-06-28 22:11:13 GMT" + }, "xAxis" : { "type" : "category", "labels" : { "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" } } }, - "legend" : { - "enabled" : "false" - }, "yAxis" : { "title" : { "text" : null }, "min" : 0 }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2024]" - }, - "chart" : { - "type" : "column" - }, - "subtitle" : { - "text" : "Last updated at 2024-06-27 09:39:19 GMT" - }, "series" : [ { - "dataLabels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - }, - "color" : "#FFFFFF", - "format" : "{point.y:.0f}", - "enabled" : "true", - "align" : "right", - "rotation" : -90, - "y" : 10 - }, "name" : "Contributions", "data" : [ [ "Blog", - 5005 + 5006 ], [ "Perl", - 14239 + 14243 ], [ "Raku", 8258 ] - ] + ], + "dataLabels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "rotation" : -90, + "enabled" : "true", + "format" : "{point.y:.0f}", + "color" : "#FFFFFF", + "align" : "right", + "y" : 10 + } } ], + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2024]" + }, "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 09fa30b211..0c86e8ffaa 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,29 +1,19 @@ { "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { "format" : "{point.y}", "enabled" : 1 - } - } - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + }, + "borderWidth" : 0 } }, - "title" : { - "text" : "The Weekly Challenge Language" - }, - "legend" : { - "enabled" : "false" + "chart" : { + "type" : "column" }, "drilldown" : { "series" : [ { - "name" : "001", - "id" : "001", "data" : [ [ "Perl", @@ -37,9 +27,12 @@ "Blog", 12 ] - ] + ], + "name" : "001", + "id" : "001" }, { + "name" : "002", "data" : [ [ "Perl", @@ -54,10 +47,10 @@ 10 ] ], - "id" : "002", - "name" : "002" + "id" : "002" }, { + "name" : "003", "data" : [ [ "Perl", @@ -72,10 +65,11 @@ 9 ] ], - "name" : "003", "id" : "003" }, { + "id" : "004", + "name" : "004", "data" : [ [ "Perl", @@ -89,11 +83,10 @@ "Blog", 10 ] - ], - "id" : "004", - "name" : "004" + ] }, { + "name" : "005", "data" : [ [ "Perl", @@ -108,10 +101,10 @@ 12 ] ], - "name" : "005", "id" : "005" }, { + "id" : "006", "data" : [ [ "Perl", @@ -126,10 +119,10 @@ 7 ] ], - "name" : "006", - "id" : "006" + "name" : "006" }, { + "name" : "007", "data" : [ [ "Perl", @@ -144,10 +137,10 @@ 10 ] ], - "name" : "007", "id" : "007" }, { + "id" : "008", "data" : [ [ "Perl", @@ -162,12 +155,10 @@ 12 ] ], - "id" : "008", "name" : "008" }, { "id" : "009", - "name" : "009", "data" : [ [ "Perl", @@ -181,9 +172,11 @@ "Blog", 13 ] - ] + ], + "name" : "009" }, { + "name" : "010", "data" : [ [ "Perl", @@ -198,10 +191,11 @@ 11 ] ], - "name" : "010", "id" : "010" }, { + "id" : "011", + "name" : "011", "data" : [ [ "Perl", @@ -215,9 +209,7 @@ "Blog", 10 ] - ], - "name" : "011", - "id" : "011" + ] }, { "data" : [ @@ -234,10 +226,12 @@ 11 ] ], - "id" : "012", - "name" : "012" + "name" : "012", + "id" : "012" }, { + "id" : "013", + "name" : "013", "data" : [ [ "Perl", @@ -251,11 +245,10 @@ "Blog", 13 ] - ], - "name" : "013", - "id" : "013" + ] }, { + "id" : "014", "data" : [ [ "Perl", @@ -270,12 +263,11 @@ 15 ] ], - "id" : "014", "name" : "014" }, { - "name" : "015", "id" : "015", + "name" : "015", "data" : [ [ "Perl", @@ -328,7 +320,6 @@ ] }, { - "id" : "018", "name" : "018", "data" : [ [ @@ -343,9 +334,11 @@ "Blog", 14 ] - ] + ], + "id" : "018" }, { + "name" : "019", "data" : [ [ "Perl", @@ -360,10 +353,11 @@ 13 ] ], - "id" : "019", - "name" : "019" + "id" : "019" }, { + "id" : "020", + "name" : "020", "data" : [ [ "Perl", @@ -377,11 +371,11 @@ "Blog", 13 ] - ], - "id" : "020", - "name" : "020" + ] }, { + "id" : "021", + "name" : "021", |
