diff options
| -rw-r--r-- | challenge-081/mohammad-anwar/perl/ch-1.pl | 53 | ||||
| -rw-r--r-- | challenge-081/mohammad-anwar/perl/ch-1.t | 59 | ||||
| -rw-r--r-- | stats/pwc-current.json | 418 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 64 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1158 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 712 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 110 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 50 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 78 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 118 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 50 |
14 files changed, 1619 insertions, 1507 deletions
diff --git a/challenge-081/mohammad-anwar/perl/ch-1.pl b/challenge-081/mohammad-anwar/perl/ch-1.pl new file mode 100644 index 0000000000..1f2fe7ef07 --- /dev/null +++ b/challenge-081/mohammad-anwar/perl/ch-1.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +# +# Perl Weekly Challenge - 081 +# +# Task #1: Common Base String +# +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-081 +# + +use strict; +use warnings; + +my $S1 = $ARGV[0] || "abcdabcd"; +my $S2 = $ARGV[1] || "abcdabcdabcdabcd"; + +printf("Common Base String(s): %s\n", + join(", ", common_base_strings($S1, $S2))); + +# +# +# SUBROUTINE + +sub common_base_strings { + my ($string1, $string2) = @_; + + die "ERROR: Missing string1.\n" unless defined $string1; + die "ERROR: Missing string2.\n" unless defined $string2; + + my $len_string1 = length($string1); + my $len_string2 = length($string2); + + my ($min_size, $min_string); + if ($len_string1 > $len_string2) { + $min_string = $string2; + $min_size = $len_string2; + } + else { + $min_string = $string1; + $min_size = $len_string1; + } + + my @common_base_strings = (); + for my $i (1 .. $min_size) { + my $base_str = substr($min_string, 0, $i); + push @common_base_strings, $base_str + if (($string1 eq $base_str x 2) + || + ($string2 eq $base_str x 2)); + } + + return @common_base_strings; +} diff --git a/challenge-081/mohammad-anwar/perl/ch-1.t b/challenge-081/mohammad-anwar/perl/ch-1.t new file mode 100644 index 0000000000..3af3a0a5f0 --- /dev/null +++ b/challenge-081/mohammad-anwar/perl/ch-1.t @@ -0,0 +1,59 @@ +#!/usr/bin/perl + +# +# Perl Weekly Challenge - 081 +# +# Task #1: Common Base String +# +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-081 +# + +use strict; +use warnings; +use Test::More; +use Test::Deep; + +is_deeply( [ common_base_strings("abcdabcd", "abcdabcdabcdabcd") ], + [ "abcd", "abcdabcd" ], + "testing example 1" ); + +is_deeply( [ common_base_strings("aa", "aaa") ], + [ "a" ], + "testing example 2" ); + +done_testing; + +# +# +# SUBROUTINE + +sub common_base_strings { + my ($string1, $string2) = @_; + + die "ERROR: Missing string1.\n" unless defined $string1; + die "ERROR: Missing string2.\n" unless defined $string2; + + my $len_string1 = length($string1); + my $len_string2 = length($string2); + + my ($min_size, $min_string); + if ($len_string1 > $len_string2) { + $min_string = $string2; + $min_size = $len_string2; + } + else { + $min_string = $string1; + $min_size = $len_string1; + } + + my @common_base_strings = (); + for my $i (1 .. $min_size) { + my $base_str = substr($min_string, 0, $i); + push @common_base_strings, $base_str + if (($string1 eq $base_str x 2) + || + ($string2 eq $base_str x 2)); + } + + return @common_base_strings; +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 2244c9c340..c85ec90cab 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,8 +1,163 @@ { + "title" : { + "text" : "Perl Weekly Challenge - 081" + }, + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : 0 + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, + "series" : [ + { + "data" : [ + { + "drilldown" : "Andinus", + "y" : 4, + "name" : "Andinus" + }, + { + "name" : "Athanasius", + "drilldown" : "Athanasius", + "y" : 4 + }, + { + "name" : "Colin Crain", + "y" : 1, + "drilldown" : "Colin Crain" + }, + { + "drilldown" : "Dave Jacoby", + "y" : 2, + "name" : "Dave Jacoby" + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "drilldown" : "Flavio Poletti", + "y" : 4, + "name" : "Flavio Poletti" + }, + { + "drilldown" : "James Smith", + "y" : 2, + "name" : "James Smith" + }, + { + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey", + "y" : 2 + }, + { + "name" : "Jose Luis", + "y" : 2, + "drilldown" : "Jose Luis" + }, + { + "drilldown" : "Julio de Castro", + "y" : 4, + "name" : "Julio de Castro" + }, + { + "drilldown" : "Kang-min Liu", + "y" : 2, + "name" : "Kang-min Liu" + }, + { + "name" : "Lars Thegler", + "y" : 2, + "drilldown" : "Lars Thegler" + }, + { + "y" : 2, + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson", + "y" : 2 + }, + { + "drilldown" : "Markus Holzer", + "y" : 2, + "name" : "Markus Holzer" + }, + { + "drilldown" : "Mohammad S Anwar", + "y" : 2, + "name" : "Mohammad S Anwar" + }, + { + "drilldown" : "Myoungjin Jeon", + "y" : 6, + "name" : "Myoungjin Jeon" + }, + { + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke", + "y" : 2 + }, + { + "name" : "Nuno Vieira", + "drilldown" : "Nuno Vieira", + "y" : 2 + }, + { + "name" : "Pete Houston", + "drilldown" : "Pete Houston", + "y" : 2 + }, + { + "y" : 5, + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "y" : 2, + "drilldown" : "Shawn Wagner", + "name" : "Shawn Wagner" + }, + { + "y" : 3, + "drilldown" : "Simon Green", + "name" : "Simon Green" + }, + { + "name" : "Simon Proctor", + "y" : 2, + "drilldown" : "Simon Proctor" + }, + { + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke", + "y" : 2 + }, + { + "name" : "Walt Mankowski", + "drilldown" : "Walt Mankowski", + "y" : 3 + } + ], + "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 081" + } + ], "drilldown" : { "series" : [ { - "name" : "Andinus", "data" : [ [ "Perl", @@ -13,9 +168,11 @@ 2 ] ], - "id" : "Andinus" + "id" : "Andinus", + "name" : "Andinus" }, { + "name" : "Athanasius", "id" : "Athanasius", "data" : [ [ @@ -26,41 +183,41 @@ "Raku", 2 ] - ], - "name" : "Athanasius" + ] }, { + "name" : "Colin Crain", "id" : "Colin Crain", "data" : [ [ "Blog", 1 ] - ], - "name" : "Colin Crain" + ] }, { + "id" : "Dave Jacoby", "name" : "Dave Jacoby", "data" : [ [ "Perl", 2 ] - ], - "id" : "Dave Jacoby" + ] }, { + "name" : "E. Choroba", + "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "id" : "E. Choroba", - "name" : "E. Choroba" + ] }, { "id" : "Flavio Poletti", + "name" : "Flavio Poletti", "data" : [ [ "Perl", @@ -70,41 +227,39 @@ "Blog", 2 ] - ], - "name" : "Flavio Poletti" + ] }, { + "id" : "James Smith", "name" : "James Smith", "data" : [ [ "Perl", 2 ] - ], - "id" : "James Smith" + ] }, { + "name" : "Jorg Sommrey", "id" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ], - "name" : "Jorg Sommrey" + ] }, { + "id" : "Jose Luis", "name" : "Jose Luis", "data" : [ [ "Perl", 2 ] - ], - "id" : "Jose Luis" + ] }, { - "name" : "Julio de Castro", "data" : [ [ "Perl", @@ -115,69 +270,72 @@ 2 ] ], + "name" : "Julio de Castro", "id" : "Julio de Castro" }, { - "id" : "Kang-min Liu", "data" : [ [ "Raku", 2 ] ], - "name" : "Kang-min Liu" + "name" : "Kang-min Liu", + "id" : "Kang-min Liu" }, { + "id" : "Lars Thegler", "name" : "Lars Thegler", "data" : [ [ "Perl", 2 ] - ], - "id" : "Lars Thegler" + ] }, { - "id" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] ], + "id" : "Lubos Kolouch", "name" : "Lubos Kolouch" }, { "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "id" : "Mark Anderson" + ] }, { - "name" : "Markus Holzer", "data" : [ [ "Raku", 2 ] ], - "id" : "Markus Holzer" + "id" : "Markus Holzer", + "name" : "Markus Holzer" }, { + "id" : "Mohammad S Anwar", "name" : "Mohammad S Anwar", "data" : [ [ "Perl", - 1 + 2 ] - ], - "id" : "Mohammad S Anwar" + ] }, { + "id" : "Myoungjin Jeon", + "name" : "Myoungjin Jeon", "data" : [ [ "Perl", @@ -191,39 +349,37 @@ "Blog", 2 ] - ], - "id" : "Myoungjin Jeon", - "name" : "Myoungjin Jeon" + ] }, { - "name" : "Niels van Dijke", - "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Niels van Dijke", + "name" : "Niels van Dijke" }, { "name" : "Nuno Vieira", + "id" : "Nuno Vieira", "data" : [ [ "Perl", 2 ] - ], - "id" : "Nuno Vieira" + ] }, { + "name" : "Pete Houston", "id" : "Pete Houston", "data" : [ [ "Perl", 2 ] - ], - "name" : "Pete Houston" + ] }, { "data" : [ @@ -244,14 +400,14 @@ "name" : "Roger Bell_West" }, { + "id" : "Shawn Wagner", "name" : "Shawn Wagner", "data" : [ [ "Perl", 2 ] - ], - "id" : "Shawn Wagner" + ] }, { "name" : "Simon Green", @@ -278,6 +434,7 @@ ] }, { + "name" : "Ulrich Rieke", "id" : "Ulrich Rieke", "data" : [ [ @@ -288,11 +445,9 @@ "Raku", 1 ] - ], - "name" : "Ulrich Rieke" + ] }, { - "name" : "Walt Mankowski", "data" : [ [ "Perl", @@ -303,180 +458,25 @@ 1 ] ], + "name" : "Walt Mankowski", "id" : "Walt Mankowski" } ] }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "Perl Weekly Challenge - 081" - }, "chart" : { "type" : "column" }, "subtitle" : { - "text" : "[Champions: 26] Last updated at 2020-10-11 04:03:42 GMT" + "text" : "[Champions: 26] Last updated at 2020-10-11 05:36:57 GMT" }, - "xAxis" : { - "type" : "category" + "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/>" }, "yAxis" : { "title" : { "text" : "Total Solutions" } - }, - "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 - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "Andinus", - "y" : 4, - "name" : "Andinus" - }, - { - "y" : 4, - "drilldown" : "Athanasius", - "name" : "Athanasius" - }, - { - "y" : 1, - "drilldown" : "Colin Crain", - "name" : "Colin Crain" - }, - { - "name" : "Dave Jacoby", - "y" : 2, - "drilldown" : "Dave Jacoby" - }, - { - "name" : "E. Choroba", - "y" : 2, - "drilldown" : "E. Choroba" - }, - { - "drilldown" : "Flavio Poletti", - "y" : 4, - "name" : "Flavio Poletti" - }, - { - "name" : "James Smith", - "drilldown" : "James Smith", - "y" : 2 - }, - { - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey", - "y" : 2 - }, - { - "drilldown" : "Jose Luis", - "y" : 2, - "name" : "Jose Luis" - }, - { - "name" : "Julio de Castro", - "drilldown" : "Julio de Castro", - "y" : 4 - }, - { - "name" : "Kang-min Liu", - "drilldown" : "Kang-min Liu", - "y" : 2 - }, - { - "drilldown" : "Lars Thegler", - "y" : 2, - "name" : "Lars Thegler" - }, - { - "name" : "Lubos Kolouch", - "y" : 2, - "drilldown" : "Lubos Kolouch" - }, - { - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Markus Holzer", - "y" : 2, - "name" : "Markus Holzer" - }, - { - "drilldown" : "Mohammad S Anwar", - "y" : 1, - "name" : "Mohammad S Anwar" - }, - { - "y" : 6, - "drilldown" : "Myoungjin Jeon", - "name" : "Myoungjin Jeon" - }, - { - "drilldown" : "Niels van Dijke", - "y" : 2, - "name" : "Niels van Dijke" - }, - { - "drilldown" : "Nuno Vieira", - "y" : 2, - "name" : "Nuno Vieira" - }, - { - "drilldown" : "Pete Houston", - "y" : 2, - "name" : "Pete Houston" - }, - { - "name" : "Roger Bell_West", - "y" : 5, - "drilldown" : "Roger Bell_West" - }, - { - "name" : "Shawn Wagner", - "drilldown" : "Shawn Wagner", - "y" : 2 - }, - { - "name" : "Simon Green", - "y" : 3, - "drilldown" : "Simon Green" - }, - { - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor", - "y" : 2 - }, - { - "drilldown" : "Ulrich Rieke", - "y" : 2, - "name" : "Ulrich Rieke" - }, - { - "y" : 3, - "drilldown" : "Walt Mankowski", - "name" : "Walt Mankowski" - } - ], - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 081" - } - ] + } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index c4dbb4fbf0..3e5d3256d1 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,6 +1,22 @@ { + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + }, + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" + }, + "legend" : { + "enabled" : "false" + }, "series" : [ { + "name" : "Contributions", "data" : [ [ "Blog", @@ -8,7 +24,7 @@ ], [ "Perl", - 3501 + 3502 ], [ "Raku", @@ -16,48 +32,32 @@ ] ], "dataLabels" : { - "format" : "{point.y:.0f}", - "enabled" : "true", - "color" : "#FFFFFF", + "y" : 10, "rotation" : -90, + "color" : "#FFFFFF", "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" }, "align" : "right", - "y" : 10 - }, - "name" : "Contributions" + "enabled" : "true", + "format" : "{point.y:.0f}" + } } ], - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, "subtitle" : { - "text" : "Last updated at 2020-10-11 04:03:42 GMT" + "text" : "Last updated at 2020-10-11 05:36:57 GMT" }, "chart" : { "type" : "column" }, - "xAxis" : { - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "type" : "category" - }, - "legend" : { - "enabled" : "false" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index d0ae044853..f17ca2acc0 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,431 +1,7 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "tooltip" : { - "followPointer" : "true", - "headerFormat" : "<span style=\"font-size:11px\"></span>", - "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" - }, - "series" : [ - { - "data" : [ - { - "name" : "#001", - "y" : 144, - "drilldown" : "001" - }, - { - "y" : 113, - "drilldown" : "002", - "name" : "#002" - }, - { - "drilldown" : "003", - "y" : 71, - "name" : "#003" - }, - { - "drilldown" : "004", - "y" : 91, - "name" : "#004" - }, - { - "drilldown" : "005", - "y" : 72, - "name" : "#005" - }, - { - "name" : "#006", - "drilldown" : "006", - "y" : 52 - }, - { - "name" : "#007", - "drilldown" : "007", - "y" : 59 - }, - { - "name" : "#008", - "drilldown" : "008", - "y" : 72 - }, - { - "y" : 70, - "drilldown" : "009", - "name" : "#009" - }, - { - "name" : "#010", - "drilldown" : "010", - "y" : 60 - }, - { - "name" : "#011", - "y" : 79, - "drilldown" : "011" - }, - { - "y" : 83, - "drilldown" : "012", - "name" : "#012" - }, - { - "y" : 78, - "drilldown" : "013", - "name" : "#013" - }, - { - "drilldown" : "014", - "y" : 96, - "name" : "#014" - }, - { - "name" : "#015", - "drilldown" : "015", - "y" : 93 - }, - { - "name" : "#016", - "drilldown" : "016", - "y" : 66 - }, - { - "name" : "#017", - "drilldown" : "017", - "y" : 79 - }, - { - "name" : "#018", - "drilldown" : "018", - "y" : 76 - }, - { - "y" : 97, - "drilldown" : "019", - "name" : "#019" - }, - { - "name" : "#020", - "drilldown" : "020", - "y" : 95 - }, - { - "drilldown" : "021", - "y" : 67, - "name" : "#021" - }, - { - "y" : 63, - "drilldown" : "022", - "name" : "#022" - }, - { - "drilldown" : "023", - "y" : 91, - "name" : "#023" - }, - { - "y" : 70, - "drilldown" : "024", - "name" : "#024" - }, - { - "name" : "#025", - "y" : 55, - "drilldown" : "025" - }, - { - "y" : 70, - "drilldown" : "026", - "name" : "#026" - }, - { - "y" : 58, - "drilldown" : "027", - "name" : "#027" - }, - { - "name" : "#028", - "y" : 78, - "drilldown" : "028" - }, - { - "drilldown" : "029", - "y" : 77, - "name" : "#029" - }, - { - "name" : "#030", - "y" : 115, - "drilldown" : "030" - }, - { - "drilldown" : "031", - "y" : 87, - "name" : "#031" - }, - { - "y" : 92, - "drilldown" : "032", - "name" : "#032" - }, - { - "y" : 108, - "drilldown" : "033", - "name" : "#033" - }, - { - "name" : "#034", - "y" : 62, - "drilldown" : "034" - }, - { - "name" : "#035", - "drilldown" : "035", - "y" : 62 - }, - { - "name" : "#036", - "drilldown" : "036", - "y" : 66 - }, - { - "drilldown" : "037", - "y" : 65, - "name" : "#037" - }, - { - "drilldown" : "038", - "y" : 65, - "name" : "#038" - }, - { - "name" : "#039", - "drilldown" : "039", - "y" : 60 - }, - { - "drilldown" : "040", - "y" : 71, - "name" : "#040" - }, - { - "name" : "#041", - "y" : 74, - "drilldown" : "041" - }, - { - "drilldown" : "042", - "y" : 88, - "name" : "#042" - }, - { - "y" : 66, - "drilldown" : "043", - "name" : "#043" - }, - { - "y" : 82, - "drilldown" : "044", - "name" : "#044" - }, - { - "y" : 94, - "drilldown" : "045", - "name" : "#045" - }, - { - "name" : "#046", - "drilldown" : "046", - "y" : 85 - }, - { - "drilldown" : "047", - "y" : 82, - "name" : "#047" - }, - { - "drilldown" : "048", - "y" : 106, - "name" : "#048" - }, - { - "drilldown" : "049", - "y" : 85, - "name" : "#049" - }, - { - "drilldown" : "050", - "y" : 96, - "name" : "#050" - }, - { - "y" : 87, - "drilldown" : "051", - "name" : "#051" - }, - { - "name" |
