aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2020-10-17 15:42:52 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2020-10-17 15:42:52 +0100
commite8d83a10c2044eba1be500684d2caa4577400c85 (patch)
tree7abf6aa54f53823e9237104bc5fd0dbd4a51e403
parent1da19f820e6c7dc5844eb1c6ea53c11be9fc3877 (diff)
downloadperlweeklychallenge-club-e8d83a10c2044eba1be500684d2caa4577400c85.tar.gz
perlweeklychallenge-club-e8d83a10c2044eba1be500684d2caa4577400c85.tar.bz2
perlweeklychallenge-club-e8d83a10c2044eba1be500684d2caa4577400c85.zip
- Added solutions by Pete Houston.
-rw-r--r--challenge-082/pete-houston/perl/ch-1.pl38
-rw-r--r--challenge-082/pete-houston/perl/ch-2.pl50
-rw-r--r--stats/pwc-current.json221
-rw-r--r--stats/pwc-language-breakdown-summary.json64
-rw-r--r--stats/pwc-language-breakdown.json574
-rw-r--r--stats/pwc-leaders.json768
-rw-r--r--stats/pwc-summary-1-30.json110
-rw-r--r--stats/pwc-summary-121-150.json42
-rw-r--r--stats/pwc-summary-151-180.json110
-rw-r--r--stats/pwc-summary-181-210.json84
-rw-r--r--stats/pwc-summary-31-60.json98
-rw-r--r--stats/pwc-summary-61-90.json30
-rw-r--r--stats/pwc-summary-91-120.json36
-rw-r--r--stats/pwc-summary.json32
14 files changed, 1180 insertions, 1077 deletions
diff --git a/challenge-082/pete-houston/perl/ch-1.pl b/challenge-082/pete-houston/perl/ch-1.pl
new file mode 100644
index 0000000000..52857706a6
--- /dev/null
+++ b/challenge-082/pete-houston/perl/ch-1.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+#===============================================================================
+#
+# FILE: 8201.pl
+#
+# USAGE: ./8201.pl A B
+#
+# DESCRIPTION: Display all common divisors of natural numbers A and B
+#
+# REQUIREMENTS: Params::Util, List::Util
+# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+# ORGANIZATION: Openstrike
+# VERSION: 1.0
+# CREATED: 17/10/20
+#===============================================================================
+
+use strict;
+use warnings;
+
+use Params::Util '_POSINT';
+use List::Util qw/min none/;
+
+# Validate input
+for (@ARGV) {
+ die "$_ must be a natural number" unless _POSINT ($_);
+}
+
+# Start at highest possible potential divisor
+my $i = min (@ARGV);
+my @div;
+
+# Iterate downwards to 1
+while ($i > 0) {
+ push @div, $i if none { $_ % $i } @ARGV;
+ $i--;
+}
+
+print "@div\n";
diff --git a/challenge-082/pete-houston/perl/ch-2.pl b/challenge-082/pete-houston/perl/ch-2.pl
new file mode 100644
index 0000000000..5b80c7bd22
--- /dev/null
+++ b/challenge-082/pete-houston/perl/ch-2.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+#===============================================================================
+#
+# FILE: 8202.pl
+#
+# USAGE: ./8202.pl substr1 substr2 str
+#
+# DESCRIPTION: Report if str can be made by "interleaving" the substrs
+#
+# NOTES: Prints 1 if the string can be made, otherwise 0
+# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+# ORGANIZATION: Openstrike
+# VERSION: 1.0
+# CREATED: 17/10/20
+#===============================================================================
+
+use strict;
+use warnings;
+
+my @sub = @ARGV;
+my $str = pop @sub;
+
+# No point going further if this basic test fails
+nope () if length ($str) ne length ($sub[0] . $sub[1]);
+
+# Try tucking first substring into second, then vice-versa
+for my $i (0, 1) {
+ my $j = 1 - $i;
+ my $jpos = index ($str, $sub[$j]);
+ while ($jpos > -1) {
+ # $sub[$j] is contained within $str, so strip it and see if we
+ # are left with $sub[$i]
+ my $copy = $str;
+ substr ($copy, $jpos, length ($sub[$j]), '');
+ yep () if $copy eq $sub[$i];
+ # No joy, so keep looking
+ $jpos = index ($str, $sub[$j], $jpos + 1);
+ }
+}
+nope ();
+
+sub yep {
+ print "1\n";
+ exit;
+}
+
+sub nope {
+ print "0\n";
+ exit;
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index e28c9ec9bd..f48cfa8b9e 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,27 +1,14 @@
{
- "chart" : {
- "type" : "column"
- },
- "title" : {
- "text" : "Perl Weekly Challenge - 082"
- },
- "subtitle" : {
- "text" : "[Champions: 24] Last updated at 2020-10-17 14:36:16 GMT"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
+ "xAxis" : {
+ "type" : "category"
},
"series" : [
{
- "name" : "Perl Weekly Challenge - 082",
- "colorByPoint" : 1,
"data" : [
{
"drilldown" : "Abigail",
- "name" : "Abigail",
- "y" : 4
+ "y" : 4,
+ "name" : "Abigail"
},
{
"name" : "Alexander Pankoff",
@@ -29,8 +16,8 @@
"y" : 2
},
{
- "drilldown" : "Andinus",
"y" : 2,
+ "drilldown" : "Andinus",
"name" : "Andinus"
},
{
@@ -39,13 +26,13 @@
"name" : "Andrew Shitov"
},
{
+ "y" : 1,
"drilldown" : "Colin Crain",
- "name" : "Colin Crain",
- "y" : 1
+ "name" : "Colin Crain"
},
{
- "y" : 3,
"drilldown" : "Dave Jacoby",
+ "y" : 3,
"name" : "Dave Jacoby"
},
{
@@ -54,44 +41,44 @@
"name" : "E. Choroba"
},
{
- "y" : 2,
"drilldown" : "Feng Chang",
+ "y" : 2,
"name" : "Feng Chang"
},
{
"drilldown" : "Flavio Poletti",
- "name" : "Flavio Poletti",
- "y" : 4
+ "y" : 4,
+ "name" : "Flavio Poletti"
},
{
- "name" : "Jose Luis",
+ "y" : 2,
"drilldown" : "Jose Luis",
- "y" : 2
+ "name" : "Jose Luis"
},
{
+ "name" : "Julio de Castro",
"drilldown" : "Julio de Castro",
- "y" : 4,
- "name" : "Julio de Castro"
+ "y" : 4
},
{
- "name" : "Kang-min Liu",
+ "y" : 4,
"drilldown" : "Kang-min Liu",
- "y" : 4
+ "name" : "Kang-min Liu"
},
{
"drilldown" : "Lubos Kolouch",
- "name" : "Lubos Kolouch",
- "y" : 2
+ "y" : 2,
+ "name" : "Lubos Kolouch"
},
{
- "drilldown" : "Mark Anderson",
+ "name" : "Mark Anderson",
"y" : 2,
- "name" : "Mark Anderson"
+ "drilldown" : "Mark Anderson"
},
{
- "y" : 2,
+ "name" : "Markus Holzer",
"drilldown" : "Markus Holzer",
- "name" : "Markus Holzer"
+ "y" : 2
},
{
"drilldown" : "Myoungjin Jeon",
@@ -99,14 +86,19 @@
"name" : "Myoungjin Jeon"
},
{
- "name" : "Niels van Dijke",
"drilldown" : "Niels van Dijke",
- "y" : 2
+ "y" : 2,
+ "name" : "Niels van Dijke"
},
{
"name" : "Nuno Vieira",
- "drilldown" : "Nuno Vieira",
- "y" : 2
+ "y" : 2,
+ "drilldown" : "Nuno Vieira"
+ },
+ {
+ "drilldown" : "Pete Houston",
+ "y" : 2,
+ "name" : "Pete Houston"
},
{
"drilldown" : "Roger Bell_West",
@@ -119,42 +111,37 @@
"name" : "Simon Green"
},
{
+ "name" : "Simon Proctor",
"y" : 2,
- "drilldown" : "Simon Proctor",
- "name" : "Simon Proctor"
+ "drilldown" : "Simon Proctor"
},
{
+ "y" : 1,
"drilldown" : "Steven Wilson",
- "name" : "Steven Wilson",
- "y" : 1
+ "name" : "Steven Wilson"
},
{
- "name" : "Ulrich Rieke",
"drilldown" : "Ulrich Rieke",
- "y" : 4
+ "y" : 4,
+ "name" : "Ulrich Rieke"
},
{
"name" : "Vinod Kumar K",
- "drilldown" : "Vinod Kumar K",
- "y" : 1
+ "y" : 1,
+ "drilldown" : "Vinod Kumar K"
}
- ]
+ ],
+ "name" : "Perl Weekly Challenge - 082",
+ "colorByPoint" : 1
}
],
- "legend" : {
- "enabled" : 0
- },
- "xAxis" : {
- "type" : "category"
- },
- "tooltip" : {
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
- "followPointer" : 1,
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>"
+ "chart" : {
+ "type" : "column"
},
"drilldown" : {
"series" : [
{
+ "name" : "Abigail",
"data" : [
[
"Perl",
@@ -165,18 +152,17 @@
2
]
],
- "name" : "Abigail",
"id" : "Abigail"
},
{
+ "name" : "Alexander Pankoff",
+ "id" : "Alexander Pankoff",
"data" : [
[
"Perl",
2
]
- ],
- "id" : "Alexander Pankoff",
- "name" : "Alexander Pankoff"
+ ]
},
{
"data" : [
@@ -189,8 +175,8 @@
1
]
],
- "name" : "Andinus",
- "id" : "Andinus"
+ "id" : "Andinus",
+ "name" : "Andinus"
},
{
"name" : "Andrew Shitov",
@@ -203,18 +189,17 @@
]
},
{
- "id" : "Colin Crain",
- "name" : "Colin Crain",
"data" : [
[
"Blog",
1
]
- ]
+ ],
+ "id" : "Colin Crain",
+ "name" : "Colin Crain"
},
{
"id" : "Dave Jacoby",
- "name" : "Dave Jacoby",
"data" : [
[
"Perl",
@@ -224,16 +209,17 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "Dave Jacoby"
},
{
+ "id" : "E. Choroba",
"data" : [
[
"Perl",
2
]
],
- "id" : "E. Choroba",
"name" : "E. Choroba"
},
{
@@ -243,10 +229,12 @@
2
]
],
- "name" : "Feng Chang",
- "id" : "Feng Chang"
+ "id" : "Feng Chang",
+ "name" : "Feng Chang"
},
{
+ "name" : "Flavio Poletti",
+ "id" : "Flavio Poletti",
"data" : [
[
"Perl",
@@ -256,21 +244,20 @@
"Blog",
2
]
- ],
- "id" : "Flavio Poletti",
- "name" : "Flavio Poletti"
+ ]
},
{
- "name" : "Jose Luis",
- "id" : "Jose Luis",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "id" : "Jose Luis",
+ "name" : "Jose Luis"
},
{
+ "id" : "Julio de Castro",
"data" : [
[
"Perl",
@@ -281,12 +268,11 @@
2
]
],
- "name" : "Julio de Castro",
- "id" : "Julio de Castro"
+ "name" : "Julio de Castro"
},
{
- "id" : "Kang-min Liu",
"name" : "Kang-min Liu",
+ "id" : "Kang-min Liu",
"data" : [
[
"Raku",
@@ -299,28 +285,28 @@
]
},
{
+ "name" : "Lubos Kolouch",
"data" : [
[
"Perl",
2
]
],
- "id" : "Lubos Kolouch",
- "name" : "Lubos Kolouch"
+ "id" : "Lubos Kolouch"
},
{
+ "name" : "Mark Anderson",
+ "id" : "Mark Anderson",
"data" : [
[
"Raku",
2
]
- ],
- "id" : "Mark Anderson",
- "name" : "Mark Anderson"
+ ]
},
{
- "id" : "Markus Holzer",
"name" : "Markus Holzer",
+ "id" : "Markus Holzer",
"data" : [
[
"Raku",
@@ -348,26 +334,35 @@
},
{
"id" : "Niels van Dijke",
- "name" : "Niels van Dijke",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "Niels van Dijke"
},
{
- "name" : "Nuno Vieira",
"id" : "Nuno Vieira",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "Nuno Vieira"
+ },
+ {
+ "name" : "Pete Houston",
+ "data" : [
+ [
+ "Perl",
+ 2
+ ]
+ ],
+ "id" : "Pete Houston"
},
{
- "id" : "Roger Bell_West",
"name" : "Roger Bell_West",
"data" : [
[
@@ -382,7 +377,8 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "Roger Bell_West"
},
{
"data" : [
@@ -395,17 +391,17 @@
1
]
],
- "name" : "Simon Green",
- "id" : "Simon Green"
+ "id" : "Simon Green",
+ "name" : "Simon Green"
},
{
+ "name" : "Simon Proctor",
"data" : [
[
"Raku",
2
]
],
- "name" : "Simon Proctor",
"id" : "Simon Proctor"
},
{
@@ -420,7 +416,6 @@
},
{
"name" : "Ulrich Rieke",
- "id" : "Ulrich Rieke",
"data" : [
[
"Perl",
@@ -430,27 +425,47 @@
"Raku",
2
]
- ]
+ ],
+ "id" : "Ulrich Rieke"
},
{
+ "name" : "Vinod Kumar K",
"data" : [
[
"Perl",
1
]
],
- "id" : "Vinod Kumar K",
- "name" : "Vinod Kumar K"
+ "id" : "Vinod Kumar K"
}
]
},
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "title" : {
+ "text" : "Perl Weekly Challenge - 082"
+ },
+ "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
+ },
"plotOptions" : {
"series" : {
"borderWidth" : 0,
"dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
+ "format" : "{point.y}",
+ "enabled" : 1
}
}
+ },
+ "subtitle" : {
+ "text" : "[Champions: 25] Last updated at 2020-10-17 14:42:40 GMT"
+ },
+ "legend" : {
+ "enabled" : 0
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 2820ea5a0e..876be7d6e1 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,15 +1,18 @@
{
- "subtitle" : {
- "text" : "Last updated at 2020-10-17 14:36:16 GMT"
- },
- "title" : {
- "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
- },
- "chart" : {
- "type" : "column"
+ "xAxis" : {
+ "type" : "category",
+ "labels" : {
+ "style" : {
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
+ }
+ }
},
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
+ "yAxis" : {
+ "min" : 0,
+ "title" : {
+ "text" : null
+ }
},
"series" : [
{
@@ -21,7 +24,7 @@
],
[
"Perl",
- 3554
+ 3556
],
[
"Raku",
@@ -29,35 +32,32 @@
]
],
"dataLabels" : {
- "rotation" : -90,
- "align" : "right",
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- },
+ "color" : "#FFFFFF",
+ "enabled" : "true",
"y" : 10,
"format" : "{point.y:.0f}",
- "enabled" : "true",
- "color" : "#FFFFFF"
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ },
+ "rotation" : -90,
+ "align" : "right"
}
}
],
+ "chart" : {
+ "type" : "column"
+ },
+ "title" : {
+ "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
+ },
"legend" : {
"enabled" : "false"
},
- "xAxis" : {
- "labels" : {
- "style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- }
- },
- "type" : "category"
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
},
- "yAxis" : {
- "title" : {
- "text" : null
- },
- "min" : 0
+ "subtitle" : {
+ "text" : "Last updated at 2020-10-17 14:42:40 GMT"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index c70c4a1555..103cc29f1c 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,21 +1,9 @@
{
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-10-17 14:36:16 GMT"
- },
- "title" : {
- "text" : "Perl Weekly Challenge Language"
- },
- "chart" : {
- "type" : "column"
- },
- "tooltip" : {
- "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
- "followPointer" : "true",
- "headerFormat" : "<span style=\"font-size:11px\"></span>"
- },
"drilldown" : {
"series" : [
{
+ "name" : "001",
+ "id" : "001",
"data" : [
[
"Perl",
@@ -29,11 +17,11 @@
"Blog",
11
]
- ],
- "name" : "001",
- "id" : "001"
+ ]
},
{
+ "name" : "002",
+ "id" : "002",
"data" : [
[
"Perl",
@@ -47,12 +35,9 @@
"Blog",
10
]
- ],
- "name" : "002",
- "id" : "002"
+ ]
},
{
- "name" : "003",
"id" : "003",
"data" : [
[
@@ -67,11 +52,12 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "003"
},
{
- "id" : "004",
"name" : "004",
+ "id" : "004",
"data" : [
[
"Perl",
@@ -88,6 +74,7 @@
]
},
{
+ "id" : "005",
"data" : [
[
"Perl",
@@ -102,12 +89,10 @@
12
]
],
- "name" : "005",
- "id" : "005"
+ "name" : "005"
},
{
"id" : "006",
- "name" : "006",
"data" : [
[
"Perl",
@@ -121,10 +106,10 @@
"Blog",
7
]
- ]
+ ],
+ "name" : "006"
},
{
- "id" : "007",
"name" : "007",
"data" : [
[
@@ -139,9 +124,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "007"
},
{
+ "id" : "008",
"data" : [
[
"Perl",
@@ -156,12 +143,9 @@
12
]
],
- "id" : "008",
"name" : "008"
},
{
- "name" : "009",
- "id" : "009",
"data" : [
[
"Perl",
@@ -175,11 +159,12 @@
"Blog",
13
]
- ]
+ ],
+ "id" : "009",
+ "name" : "009"
},
{
"name" : "010",
- "id" : "010",
"data" : [
[
"Perl",
@@ -193,10 +178,10 @@
"Blog",
11
]
- ]
+ ],
+ "id" : "010"
},
{
- "name" : "011",
"id" : "011",
"data" : [
[
@@ -211,11 +196,12 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "011"
},
{
- "id" : "012",
"name" : "012",
+ "id" : "012",
"data" : [
[
"Perl",
@@ -232,6 +218,8 @@
]
},
{
+ "name" : "013",
+ "id" : "013",
"data" : [
[
"Perl",
@@ -245,11 +233,10 @@
"Blog",
13
]
- ],
- "id" : "013",
- "name" : "013"
+ ]
},
{
+ "name" : "014",
"data" : [
[
"Perl",
@@ -264,10 +251,10 @@
15
]
],
- "name" : "014",
"id" : "014"
},
{
+ "id" : "015",
"data" : [
[
"Perl",
@@ -282,7 +269,6 @@
15
]
],
- "id" : "015",
"name" : "015"
},
{
@@ -300,10 +286,11 @@
12
]
],
- "name" : "016",
- "id" : "016"
+ "id" : "016",
+ "name" : "016"
},
{
+ "id" : "017",
"data" : [
[
"Perl",
@@ -318,10 +305,10 @@
12
]
],
- "name" : "017",
- "id" : "017"
+ "name" : "017"
},
{
+ "name" : "018",
"data" : [
[
"Perl",
@@ -336,12 +323,9 @@
14
]
],
- "name" : "018",
"id" : "018"
},
{
- "id" : "019",
- "name" : "019",
"data" : [
[
"Perl",
@@ -355,11 +339,13 @@
"Blog",
13
]
- ]
+ ],
+ "id" : "019",
+ "name" : "019"
},
{
- "id" : "020",
"name" : "020",
+ "id" : "020",
"data" : [
[
"Perl",
@@ -376,6 +362,8 @@
]
},
{
+ "name" : "021",
+ "id" : "021",
"data" : [
[
"Perl",
@@ -389,13 +377,9 @@
"Blog",
10
]
- ],
- "name" : "021",
- "id" : "021"
+ ]
},
{
- "name" : "022",
- "id" : "022",
"data" : [
[
"Perl",
@@ -409,10 +393,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "022",
+ "name" : "022"
},
{
- "name" : "023",
"id" : "023",
"data" : [
[
@@ -427,10 +412,10 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "023"
},
{
- "name" : "024",
"id" : "024",
"data" : [
[
@@ -445,10 +430,10 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "024"
},
{
- "name" : "025",
"id" : "025",
"data" : [
[
@@ -463,7 +448,8 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "025"
},
{
"data" : [
@@ -480,8 +466,8 @@
10
]
],
- "name" : "026",
- "id" : "026"
+ "id" : "026",
+ "name" : "026"
},
{
"data" : [
@@ -498,11 +484,10 @@
9
]
],
- "name" : "027",
- "id" : "027"
+ "id" : "027",
+ "name" : "027"
},
{
- "id" : "028",
"name" : "028",
"data" : [
[
@@ -517,9 +502,12 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "028"
},
{
+ "name" : "029",
+ "id" : "029",
"data" : [
[
"Perl",
@@ -533,11 +521,10 @@
"Blog",
12
]
- ],
- "name" : "029",
- "id" : "029"
+ ]
},
{
+ "name" : "030",
"data" : [
[
"Perl",
@@ -552,12 +539,9 @@
10
]
],
- "id" : "030",
- "name" : "030"
+ "id" : "030"
},
{
- "name" : "031",
- "id" : "031",
"data" : [
[
"Perl",
@@ -571,7 +555,9 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "031",
+ "name" : "031"
},
{
"data" : [
@@ -588,8 +574