aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-189/mohammad-anwar/perl/ch-1.pl36
-rw-r--r--challenge-189/mohammad-anwar/perl/ch-2.pl70
-rw-r--r--stats/pwc-current.json297
-rw-r--r--stats/pwc-language-breakdown-summary.json44
-rw-r--r--stats/pwc-language-breakdown.json1310
-rw-r--r--stats/pwc-leaders.json724
-rw-r--r--stats/pwc-summary-1-30.json34
-rw-r--r--stats/pwc-summary-121-150.json50
-rw-r--r--stats/pwc-summary-151-180.json40
-rw-r--r--stats/pwc-summary-181-210.json98
-rw-r--r--stats/pwc-summary-211-240.json54
-rw-r--r--stats/pwc-summary-241-270.json104
-rw-r--r--stats/pwc-summary-271-300.json30
-rw-r--r--stats/pwc-summary-31-60.json102
-rw-r--r--stats/pwc-summary-61-90.json30
-rw-r--r--stats/pwc-summary-91-120.json48
-rw-r--r--stats/pwc-summary.json44
17 files changed, 1618 insertions, 1497 deletions
diff --git a/challenge-189/mohammad-anwar/perl/ch-1.pl b/challenge-189/mohammad-anwar/perl/ch-1.pl
new file mode 100644
index 0000000000..7e0d7f2806
--- /dev/null
+++ b/challenge-189/mohammad-anwar/perl/ch-1.pl
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+=head1
+
+Week 189:
+
+ https://theweeklychallenge.org/blog/perl-weekly-challenge-189
+
+Task #1: Greater Character
+
+ You are given an array of characters (a..z) and a target character.
+
+ Write a script to find out the smallest character in the given
+ array lexicographically greater than the target character.
+
+=cut
+
+use v5.36;
+use Test2::V0;
+
+is greater_character('b', qw/e m u g/, 'b'), 'e', 'Example 1';
+is greater_character('a', qw/d c e f/, 'a'), 'c', 'Example 2';
+is greater_character('o', qw/j a r/ , 'o'), 'r', 'Example 3';
+is greater_character('a', qw/d c a f/, 'a'), 'c', 'Example 4';
+is greater_character('v', qw/t g a l/, 'v'), 'v', 'Example 5';
+
+done_testing;
+
+#
+#
+# METHOD
+
+sub greater_character($t, @chars) {
+ for (sort @chars) { return $_ if ord > ord $t }
+ return $t;
+}
diff --git a/challenge-189/mohammad-anwar/perl/ch-2.pl b/challenge-189/mohammad-anwar/perl/ch-2.pl
new file mode 100644
index 0000000000..9b979eaa2c
--- /dev/null
+++ b/challenge-189/mohammad-anwar/perl/ch-2.pl
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+=head1
+
+Week 189:
+
+ https://theweeklychallenge.org/blog/perl-weekly-challenge-189
+
+Task #2: Array Degree
+
+ You are given an array of 2 or more non-negative integers.
+
+ Write a script to find out the smallest subarray having the degree
+ of the given array.
+
+ The degree of an array is the maximum frequence of an element in
+ the array.
+
+=cut
+
+use v5.36;
+use Test2::V0;
+use Algorithm::Combinatorics qw(subsets);
+
+is array_degree(1, 3, 3, 2) , [3, 3], 'Example 1';
+is array_degree(1, 2, 1, 3) , [1, 2, 1], 'Example 2';
+is array_degree(1, 3, 2, 1, 2), [2, 1, 2], 'Example 3';
+is array_degree(1, 1, 2, 3, 2), [1, 1], 'Example 4';
+is array_degree(2, 1, 2, 1, 1), [1, 2, 1, 1], 'Example 5';
+
+done_testing;
+
+#
+#
+# METHODS
+
+sub array_degree(@list) {
+ my %h;
+ my $x = join(q{}, @list);
+ my %seen;
+ foreach my $k (2 .. scalar(@list)) {
+ my $entries = subsets(\@list, $k);
+ while (my $entry = $entries->next) {
+ my $y = join(q{}, @$entry);
+ next if $seen{$y};
+ next unless ($x =~ /$y/);
+ $h{ join(":", @$entry) } = _array_degree($entry);
+ $seen{$y} = 1;
+ }
+ }
+
+ my $d = $h{[ sort { $h{$b} <=> $h{$a} } keys %h ]->[0]};
+ my $s = 0;
+ my $r;
+ foreach my $e (keys %h) {
+ if ($h{$e} == $d) {
+ if ($s == 0 || length($e) <= $s) {
+ $r = $e;
+ $s = length($e);
+ }
+ }
+ }
+
+ return [ split /\:/, $r ];
+}
+
+sub _array_degree($data) {
+ my %e; ++$e{$_} for @$data;
+ return $e{[ sort { $e{$b} <=> $e{$a} } keys %e ]->[0]};
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index a8afd6dfb0..028502e411 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,129 +1,23 @@
{
- "subtitle" : {
- "text" : "[Champions: 15] Last updated at 2022-11-01 16:59:09 GMT"
+ "chart" : {
+ "type" : "column"
},
"yAxis" : {
"title" : {
"text" : "Total Solutions"
}
},
- "title" : {
- "text" : "The Weekly Challenge - 189"
- },
- "legend" : {
- "enabled" : 0
- },
- "chart" : {
- "type" : "column"
- },
- "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" : [
- {
- "name" : "The Weekly Challenge - 189",
- "data" : [
- {
- "name" : "Alexander Pankoff",
- "drilldown" : "Alexander Pankoff",
- "y" : 2
- },
- {
- "y" : 2,
- "name" : "Andrew Grangaard",
- "drilldown" : "Andrew Grangaard"
- },
- {
- "y" : 2,
- "drilldown" : "Humberto Massa",
- "name" : "Humberto Massa"
- },
- {
- "drilldown" : "James Smith",
- "name" : "James Smith",
- "y" : 3
- },
- {
- "name" : "Laurent Rosenfeld",
- "drilldown" : "Laurent Rosenfeld",
- "y" : 5
- },
- {
- "y" : 4,
- "drilldown" : "Luca Ferrari",
- "name" : "Luca Ferrari"
- },
- {
- "y" : 2,
- "name" : "Mark Anderson",
- "drilldown" : "Mark Anderson"
- },
- {
- "drilldown" : "Niels van Dijke",
- "name" : "Niels van Dijke",
- "y" : 2
- },
- {
- "y" : 3,
- "name" : "Peter Campbell Smith",
- "drilldown" : "Peter Campbell Smith"
- },
- {
- "y" : 2,
- "drilldown" : "Robbie Hatley",
- "name" : "Robbie Hatley"
- },
- {
- "name" : "Robert DiCicco",
- "drilldown" : "Robert DiCicco",
- "y" : 2
- },
- {
- "y" : 4,
- "drilldown" : "Roger Bell_West",
- "name" : "Roger Bell_West"
- },
- {
- "y" : 2,
- "name" : "Tim Potapov",
- "drilldown" : "Tim Potapov"
- },
- {
- "name" : "Ulrich Rieke",
- "drilldown" : "Ulrich Rieke",
- "y" : 4
- },
- {
- "drilldown" : "W. Luis Mochan",
- "name" : "W. Luis Mochan",
- "y" : 3
- }
- ],
- "colorByPoint" : 1
- }
- ],
- "plotOptions" : {
- "series" : {
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- },
- "borderWidth" : 0
- }
- },
"drilldown" : {
"series" : [
{
+ "id" : "Alexander Pankoff",
"name" : "Alexander Pankoff",
"data" : [
[
"Perl",
2
]
- ],
- "id" : "Alexander Pankoff"
+ ]
},
{
"data" : [
@@ -132,21 +26,22 @@
2
]
],
- "name" : "Andrew Grangaard",
- "id" : "Andrew Grangaard"
+ "id" : "Andrew Grangaard",
+ "name" : "Andrew Grangaard"
},
{
"id" : "Humberto Massa",
+ "name" : "Humberto Massa",
"data" : [
[
"Raku",
2
]
- ],
- "name" : "Humberto Massa"
+ ]
},
{
"id" : "James Smith",
+ "name" : "James Smith",
"data" : [
[
"Perl",
@@ -156,10 +51,11 @@
"Blog",
1
]
- ],
- "name" : "James Smith"
+ ]
},
{
+ "id" : "Laurent Rosenfeld",
+ "name" : "Laurent Rosenfeld",
"data" : [
[
"Perl",
@@ -173,12 +69,11 @@
"Blog",
1
]
- ],
- "name" : "Laurent Rosenfeld",
- "id" : "Laurent Rosenfeld"
+ ]
},
{
"id" : "Luca Ferrari",
+ "name" : "Luca Ferrari",
"data" : [
[
"Raku",
@@ -188,31 +83,41 @@
"Blog",
2
]
- ],
- "name" : "Luca Ferrari"
+ ]
},
{
"name" : "Mark Anderson",
+ "id" : "Mark Anderson",
"data" : [
[
"Raku",
2
]
- ],
- "id" : "Mark Anderson"
+ ]
},
{
+ "id" : "Mohammad S Anwar",
+ "name" : "Mohammad S Anwar",
+ "data" : [
+ [
+ "Perl",
+ 2
+ ]
+ ]
+ },
+ {
+ "id" : "Niels van Dijke",
"name" : "Niels van Dijke",
"data" : [
[
"Perl",
2
]
- ],
- "id" : "Niels van Dijke"
+ ]
},
{
"name" : "Peter Campbell Smith",
+ "id" : "Peter Campbell Smith",
"data" : [
[
"Perl",
@@ -222,21 +127,19 @@
"Blog",
1
]
- ],
- "id" : "Peter Campbell Smith"
+ ]
},
{
"id" : "Robbie Hatley",
+ "name" : "Robbie Hatley",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "Robbie Hatley"
+ ]
},
{
- "id" : "Robert DiCicco",
"data" : [
[
"Perl",
@@ -247,11 +150,10 @@
1
]
],
+ "id" : "Robert DiCicco",
"name" : "Robert DiCicco"
},
{
- "id" : "Roger Bell_West",
- "name" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -261,7 +163,9 @@
"Raku",
2
]
- ]
+ ],
+ "name" : "Roger Bell_West",
+ "id" : "Roger Bell_West"
},
{
"data" : [
@@ -270,10 +174,12 @@
2
]
],
- "name" : "Tim Potapov",
- "id" : "Tim Potapov"
+ "id" : "Tim Potapov",
+ "name" : "Tim Potapov"
},
{
+ "id" : "Ulrich Rieke",
+ "name" : "Ulrich Rieke",
"data" : [
[
"Perl",
@@ -283,13 +189,9 @@
"Raku",
2
]
- ],
- "name" : "Ulrich Rieke",
- "id" : "Ulrich Rieke"
+ ]
},
{
- "id" : "W. Luis Mochan",
- "name" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -299,11 +201,124 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "W. Luis Mochan",
+ "name" : "W. Luis Mochan"
}
]
},
"xAxis" : {
"type" : "category"
+ },
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ }
+ }
+ },
+ "subtitle" : {
+ "text" : "[Champions: 16] Last updated at 2022-11-01 17:46:38 GMT"
+ },
+ "title" : {
+ "text" : "The Weekly Challenge - 189"
+ },
+ "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" : [
+ {
+ "colorByPoint" : 1,
+ "name" : "The Weekly Challenge - 189",
+ "data" : [
+ {
+ "drilldown" : "Alexander Pankoff",
+ "name" : "Alexander Pankoff",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Andrew Grangaard",
+ "name" : "Andrew Grangaard"
+ },
+ {
+ "name" : "Humberto Massa",
+ "drilldown" : "Humberto Massa",
+ "y" : 2
+ },
+ {
+ "name" : "James Smith",
+ "drilldown" : "James Smith",
+ "y" : 3
+ },
+ {
+ "y" : 5,
+ "name" : "Laurent Rosenfeld",
+ "drilldown" : "Laurent Rosenfeld"
+ },
+ {
+ "name" : "Luca Ferrari",
+ "drilldown" : "Luca Ferrari",
+ "y" : 4
+ },
+ {
+ "name" : "Mark Anderson",
+ "drilldown" : "Mark Anderson",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Mohammad S Anwar",
+ "drilldown" : "Mohammad S Anwar"
+ },
+ {
+ "drilldown" : "Niels van Dijke",
+ "name" : "Niels van Dijke",
+ "y" : 2
+ },
+ {
+ "y" : 3,
+ "name" : "Peter Campbell Smith",
+ "drilldown" : "Peter Campbell Smith"
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Robbie Hatley",
+ "name" : "Robbie Hatley"
+ },
+ {
+ "drilldown" : "Robert DiCicco",
+ "name" : "Robert DiCicco",
+ "y" : 2
+ },
+ {
+ "y" : 4,
+ "name" : "Roger Bell_West",
+ "drilldown" : "Roger Bell_West"
+ },
+ {
+ "drilldown" : "Tim Potapov",
+ "name" : "Tim Potapov",
+ "y" : 2
+ },
+ {
+ "y" : 4,
+ "name" : "Ulrich Rieke",
+ "drilldown" : "Ulrich Rieke"
+ },
+ {
+ "y" : 3,
+ "drilldown" : "W. Luis Mochan",
+ "name" : "W. Luis Mochan"
+ }
+ ]
+ }
+ ],
+ "legend" : {
+ "enabled" : 0
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 0850e25bef..f73d0aa855 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,31 +1,31 @@
{
- "yAxis" : {
- "min" : 0,
- "title" : {
- "text" : null
- }
- },
- "subtitle" : {
- "text" : "Last updated at 2022-11-01 16:59:09 GMT"
- },
- "title" : {
- "text" : "The Weekly Challenge Contributions [2019 - 2022]"
- },
"chart" : {
"type" : "column"
},
- "legend" : {
- "enabled" : "false"
+ "yAxis" : {
+ "title" : {
+ "text" : null
+ },
+ "min" : 0
},
"xAxis" : {
"type" : "category",
"labels" : {
"style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
}
}
},
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
+ },
+ "subtitle" : {
+ "text" : "Last updated at 2022-11-01 17:46:38 GMT"
+ },
+ "title" : {
+ "text" : "The Weekly Challenge Contributions [2019 - 2022]"
+ },
"series" : [
{
"data" : [
@@ -35,7 +35,7 @@
],
[
"Perl",
- 9223
+ 9225
],
[
"Raku",
@@ -44,12 +44,12 @@
],
"name" : "Contributions",
"dataLabels" : {
- "color" : "#FFFFFF",
+ "align" : "right",
+ "rotation" : -90,
"format" : "{point.y:.0f}",
"enabled" : "true",
- "rotation" : -90,
+ "color" : "#FFFFFF",
"y" : 10,
- "align" : "right",
"style" : {
"fontFamily" : "Verdana, sans-serif",
"fontSize" : "13px"
@@ -57,7 +57,7 @@
}
}
],
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
+ "legend" : {
+ "enabled" : "false"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index ea73d865e5..35a34dedbb 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,16 +1,9 @@
{
- "chart" : {
- "type" : "column"
- },
- "legend" : {
- "enabled" : "false"
- },
- "xAxis" : {
- "type" : "category"
- },
"drilldown" : {
"series" : [
{
+ "id" : "001",
+ "name" : "001",
"data" : [
[
"Perl",
@@ -24,12 +17,9 @@
"Blog",
11
]
- ],
- "name" : "001",
- "id" : "001"
+ ]
},
{
- "id" : "002",
"data" : [
[
"Perl",
@@ -44,9 +34,12 @@
10
]
],
- "name" : "002"
+ "name" : "002",
+ "id" : "002"
},
{
+ "name" : "003",
+ "id" : "003",
"data" : [
[
"Perl",
@@ -60,11 +53,11 @@
"Blog",
9
]
- ],
- "name" : "003",
- "id" : "003"
+ ]
},
{
+ "name" : "004",
+ "id" : "004",
"data" : [
[
"Perl",
@@ -78,11 +71,10 @@
"Blog",
10
]
- ],
- "name" : "004",
- "id" : "004"
+ ]
},
{
+ "id" : "005",
"name" : "005",
"data" : [
[
@@ -97,10 +89,10 @@
"Blog",
12
]
- ],
- "id" : "005"
+ ]
},
{
+ "id" : "006",
"name" : "006",
"data" : [
[
@@ -115,10 +107,11 @@
"Blog",
7
]
- ],
- "id" : "006"
+ ]
},
{
+ "id" : "007",
+ "name" : "007",
"data" : [
[
"Perl",
@@ -132,11 +125,10 @@
"Blog",
10
]
- ],
- "name" : "007",
- "id" : "007"
+ ]
},
{
+ "name" : "008",
"id" : "008",
"data" : [
[
@@ -151,11 +143,11 @@
"Blog",
12
]
- ],
- "name" : "008"
+ ]
},
{
"name" : "009",
+ "id" : "009",
"data" : [
[
"Perl",
@@ -169,8 +161,7 @@
"Blog",
13
]
- ],
- "id" : "009"
+ ]
},
{
"data" : [
@@ -187,11 +178,10 @@
11
]
],
- "name" : "010",
- "id" : "010"
+ "id" : "010",
+ "name" : "010"
},
{
- "name" : "011",
"data" : [
[
"Perl",
@@ -206,9 +196,12 @@
10
]
],
- "id" : "011"
+ "id" : "011",
+ "name" : "011"
},
{
+ "id" : "012",
+ "name" : "012",
"data" : [
[
"Perl",
@@ -222,12 +215,9 @@
"Blog",
11
]
- ],
- "name" : "012",
- "id" : "012"
+ ]
},
{
- "id" : "013",
"data" : [
[
"Perl",
@@ -242,7 +232,8 @@
13
]
],
- "name" : "013"
+ "name" : "013",
+ "id" : "013"
},
{
"id" : "014",
@@ -263,7 +254,6 @@
]
},
{
- "id" : "015",
"data" : [
[
"Perl",
@@ -278,9 +268,11 @@
15
]
],
+ "id" : "015",
"name" : "015"
},
{
+ "name" : "016",
"id" : "016",
"data" : [
[
@@ -295,8 +287,7 @@
"Blog",
12
]
- ],
- "name" : "016"
+ ]
},
{
"data" : [
@@ -313,12 +304,12 @@
12
]
],
- "name" : "017",
- "id" : "017"
+ "id" : "017",
+ "name" : "017"
},
{
- "id" : "018",
"name" : "018",
+ "id" : "018",
"data" : [
[
"Perl",
@@ -335,8 +326,6 @@
]
},
{
- "id" : "019",
- "name" : "019",
"data" : [
[
"Perl",
@@ -350,9 +339,13 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "019",
+ "id" : "019"
},
{
+ "id" : "020",
+ "name" : "020",
"data" : [
[
"Perl",
@@ -366,11 +359,11 @@
"Blog",
13
]
- ],
- "name" : "020",
- "id" : "020"
+ ]
},
{
+ "id" : "021",
+ "name" : "021",
"data" : [
[
"Perl",
@@ -384,9 +377,7 @@
"Blog",
10
]
- ],
- "name" : "021",
- "id" : "021"
+ ]
},
{
"id" : "022",
@@ -407,6 +398,8 @@
]
},
{
+ "id" : "023",
+ "name" : "023",
"data" : [
[
"Perl",
@@ -420,12 +413,9 @@
"Blog",
12
]
- ],
- "name" : "023",
- "id" : "023"
+ ]
},
{
- "id" : "024",
"data" : [
[
"Perl",
@@ -440,10 +430,10 @@
11
]
],
- "name" : "024"
+ "name" : "024",
+ "id" : "024"
},
{
- "name" : "025",
"data" : [
[
"Perl",
@@ -458,7 +448,8 @@
12
]
],
- "id" : "025"
+ "id" : "025",
+ "name" : "025"
},
{
"data" : [
@@ -475,12 +466,10 @@
10
]
],
- "name" : "026",
- "id" : "026"
+ "id" : "026",
+ "name" : "026"
},
{
- "id" : "027",
- "name" : "027",
"data" : [
[
"Perl",
@@ -494,9 +483,12 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "027",
+ "id" : "027"
},
{
+ "id" : "028",
"name" : "028",
"data" : [
[
@@ -511,11 +503,11 @@
"Blog",
9
]
- ],
- "id" : "028"
+ ]
},
{
"name" : "029",
+ "id" : "029",
"data" : [
[
"Perl",
@@ -529,10 +521,10 @@
"Blog",
12
]
- ],
- "id" : "029"
+ ]
},
{
+ "id" : "030",
"name" : "030",
"data" : [
[
@@ -547,11 +539,9 @@
"Blog",
10
]
- ],
- "id" : "030"
+ ]
},
{
- "id" : "031",
"data" : [
[
"Perl",
@@ -566,9 +556,12 @@
9
]
],
- "name" : "031"
+ "name" : "031",
+ "id" : "031"
},
{
+ "id" : "032",
+ "name" : "032",
"data" : [
[
"Perl",
@@ -582,13 +575,11 @@
"Blog",
10
]
- ],
- "name" : "032",
- "id" : "032"
+ ]
},
{
- "id" : "033",
"name" : "033",
+ "id" : "033",
"data" : [
[
"Perl",
@@ -605,6 +596,7 @@
]
},
{
+ "id" : "034",
"name" : "034",
"data" : [
[
@@ -619,11 +611,9 @@
"Blog",
11
]
- ],
- "id" : "034"
+ ]
},
{
- "id" : "035",
"data" : [
[
"Perl",
@@ -638,11 +628,12 @@
9
]
],
+ "id" : "035",
"name" : "035"
},
{
- "id" : "036",
"name" : "036",
+ "id" : "036",
"data" : [
[
"Perl",
@@ -673,12 +664,10 @@
9
]
],
- "name" : "037",
- "id" : "037"
+ "id" : "037",
+ "name" : "037"
},
{
- "id" : "038",
- "name" : "038",
"data" : [
[
"Perl",
@@ -692,11 +681,11 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "038",
+ "name" : "038"
},