aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2021-10-13 18:17:18 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2021-10-13 18:17:18 +0100
commit372b86d80c774602f40f4fc156b44458004010f4 (patch)
tree1a164b6d8487a39f8aaf61bfa749c10d58e3fe77
parent0a32413d1a4087d82ecae01a716ace3130e9fc9f (diff)
downloadperlweeklychallenge-club-372b86d80c774602f40f4fc156b44458004010f4.tar.gz
perlweeklychallenge-club-372b86d80c774602f40f4fc156b44458004010f4.tar.bz2
perlweeklychallenge-club-372b86d80c774602f40f4fc156b44458004010f4.zip
- Added Perl solution to the "Distinct Terms Count" task of week 134.
-rw-r--r--challenge-134/mohammad-anwar/perl/ch-2.pl63
-rw-r--r--stats/pwc-current.json112
-rw-r--r--stats/pwc-language-breakdown-summary.json52
-rw-r--r--stats/pwc-language-breakdown.json954
-rw-r--r--stats/pwc-leaders.json758
-rw-r--r--stats/pwc-summary-1-30.json92
-rw-r--r--stats/pwc-summary-121-150.json46
-rw-r--r--stats/pwc-summary-151-180.json42
-rw-r--r--stats/pwc-summary-181-210.json28
-rw-r--r--stats/pwc-summary-211-240.json42
-rw-r--r--stats/pwc-summary-241-270.json36
-rw-r--r--stats/pwc-summary-31-60.json36
-rw-r--r--stats/pwc-summary-61-90.json116
-rw-r--r--stats/pwc-summary-91-120.json36
-rw-r--r--stats/pwc-summary.json46
15 files changed, 1261 insertions, 1198 deletions
diff --git a/challenge-134/mohammad-anwar/perl/ch-2.pl b/challenge-134/mohammad-anwar/perl/ch-2.pl
new file mode 100644
index 0000000000..97f7e20630
--- /dev/null
+++ b/challenge-134/mohammad-anwar/perl/ch-2.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+=head1
+
+Week 134:
+
+ https://theweeklychallenge.org/blog/perl-weekly-challenge-134
+
+Task #2: Distinct Terms Count
+
+ You are given 2 positive numbers, $m and $n.
+
+ Write a script to generate multiplcation table and display count
+ of distinct terms.
+
+=cut
+
+my ($table, $distinct_terms, $count_terms) = create_table(@ARGV);
+
+print sprintf("%s\n\n", join("\n", @$table));
+print sprintf("Distinct Terms: %s\n", join(", ", @$distinct_terms));
+print sprintf("Count: %d\n", $count_terms);
+
+sub create_table {
+ my ($m, $n) = @_;
+
+ die "ERROR: Missing 'm'\n." unless defined $m;
+ die "ERROR: Missing 'n'\n." unless defined $n;
+
+ die "ERROR: Invalid $m\n." if ($m < 0);
+ die "ERROR: Invalid $n\n." if ($n < 0);
+
+ my $table = [];
+ my $length = length($m * $n) + 1;
+
+ my $col = 'x | 1';
+ $col .= sprintf("%${length}d", $_) for (2 .. $n);
+ push @$table, $col;
+
+ my $line = '--+';
+ $line .= '-' for (4 .. length($col));
+ push @$table, $line;
+
+ my %terms;
+ foreach my $i (1 .. $m) {
+ $terms{$i} = 1;
+ my $row = "$i | $i";
+ foreach my $j (2 .. $n) {
+ my $k = $i * $j;
+ $terms{$k} = 1;
+ $row .= sprintf("%${length}d", $k);
+ }
+ push @$table, $row;
+ }
+
+ my $distinct_terms = [ sort { $a <=> $b } keys %terms ];
+ my $count_terms = @$distinct_terms;
+
+ return ($table, $distinct_terms, $count_terms);
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index e3d32c1a7f..485621240a 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,14 +1,11 @@
{
- "xAxis" : {
- "type" : "category"
- },
"series" : [
{
"data" : [
{
+ "y" : 2,
"name" : "Andinus",
- "drilldown" : "Andinus",
- "y" : 2
+ "drilldown" : "Andinus"
},
{
"y" : 2,
@@ -16,18 +13,18 @@
"name" : "Andrezgz"
},
{
- "name" : "Dave Jacoby",
"drilldown" : "Dave Jacoby",
+ "name" : "Dave Jacoby",
"y" : 3
},
{
- "name" : "James Smith",
"y" : 2,
- "drilldown" : "James Smith"
+ "drilldown" : "James Smith",
+ "name" : "James Smith"
},
{
- "name" : "Luca Ferrari",
"y" : 4,
+ "name" : "Luca Ferrari",
"drilldown" : "Luca Ferrari"
},
{
@@ -36,38 +33,38 @@
"y" : 2
},
{
- "y" : 1,
- "drilldown" : "Mohammad S Anwar",
- "name" : "Mohammad S Anwar"
+ "y" : 2,
+ "name" : "Mohammad S Anwar",
+ "drilldown" : "Mohammad S Anwar"
},
{
- "drilldown" : "Olivier Delouya",
"y" : 2,
- "name" : "Olivier Delouya"
+ "name" : "Olivier Delouya",
+ "drilldown" : "Olivier Delouya"
},
{
- "name" : "Roger Bell_West",
"y" : 4,
- "drilldown" : "Roger Bell_West"
+ "drilldown" : "Roger Bell_West",
+ "name" : "Roger Bell_West"
},
{
+ "name" : "Simon Proctor",
"drilldown" : "Simon Proctor",
- "y" : 2,
- "name" : "Simon Proctor"
+ "y" : 2
},
{
- "drilldown" : "Ulrich Rieke",
"y" : 3,
- "name" : "Ulrich Rieke"
+ "name" : "Ulrich Rieke",
+ "drilldown" : "Ulrich Rieke"
},
{
- "name" : "W. Luis Mochan",
"y" : 3,
+ "name" : "W. Luis Mochan",
"drilldown" : "W. Luis Mochan"
}
],
- "name" : "The Weekly Challenge - 134",
- "colorByPoint" : 1
+ "colorByPoint" : 1,
+ "name" : "The Weekly Challenge - 134"
}
],
"yAxis" : {
@@ -75,24 +72,9 @@
"text" : "Total Solutions"
}
},
- "subtitle" : {
- "text" : "[Champions: 12] Last updated at 2021-10-13 15:04:47 GMT"
- },
- "title" : {
- "text" : "The Weekly Challenge - 134"
- },
- "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
- },
- "chart" : {
- "type" : "column"
- },
"drilldown" : {
"series" : [
{
- "name" : "Andinus",
"data" : [
[
"Raku",
@@ -103,19 +85,21 @@
1
]
],
+ "name" : "Andinus",
"id" : "Andinus"
},
{
- "id" : "Andrezgz",
"data" : [
[
"Perl",
2
]
],
- "name" : "Andrezgz"
+ "name" : "Andrezgz",
+ "id" : "Andrezgz"
},
{
+ "id" : "Dave Jacoby",
"name" : "Dave Jacoby",
"data" : [
[
@@ -126,21 +110,19 @@
"Blog",
1
]
- ],
- "id" : "Dave Jacoby"
+ ]
},
{
"id" : "James Smith",
+ "name" : "James Smith",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "James Smith"
+ ]
},
{
- "name" : "Luca Ferrari",
"data" : [
[
"Raku",
@@ -151,40 +133,40 @@
2
]
],
+ "name" : "Luca Ferrari",
"id" : "Luca Ferrari"
},
{
"name" : "Mark Anderson",
+ "id" : "Mark Anderson",
"data" : [
[
"Raku",
2
]
- ],
- "id" : "Mark Anderson"
+ ]
},
{
"data" : [
[
"Perl",
- 1
+ 2
]
],
"name" : "Mohammad S Anwar",
"id" : "Mohammad S Anwar"
},
{
- "id" : "Olivier Delouya",
"data" : [
[
"Perl",
2
]
],
+ "id" : "Olivier Delouya",
"name" : "Olivier Delouya"
},
{
- "name" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -195,19 +177,21 @@
2
]
],
+ "name" : "Roger Bell_West",
"id" : "Roger Bell_West"
},
{
- "name" : "Simon Proctor",
"data" : [
[
"Raku",
2
]
],
+ "name" : "Simon Proctor",
"id" : "Simon Proctor"
},
{
+ "id" : "Ulrich Rieke",
"name" : "Ulrich Rieke",
"data" : [
[
@@ -218,11 +202,9 @@
"Raku",
2
]
- ],
- "id" : "Ulrich Rieke"
+ ]
},
{
- "name" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -233,19 +215,37 @@
1
]
],
+ "name" : "W. Luis Mochan",
"id" : "W. Luis Mochan"
}
]
},
+ "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/>"
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "chart" : {
+ "type" : "column"
+ },
+ "title" : {
+ "text" : "The Weekly Challenge - 134"
+ },
"plotOptions" : {
"series" : {
"borderWidth" : 0,
"dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
+ "format" : "{point.y}",
+ "enabled" : 1
}
}
},
+ "subtitle" : {
+ "text" : "[Champions: 12] Last updated at 2021-10-13 17:15:41 GMT"
+ },
"legend" : {
"enabled" : 0
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 26bb589a3d..5a25579400 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,42 +1,25 @@
{
- "chart" : {
- "type" : "column"
- },
"legend" : {
"enabled" : "false"
},
"subtitle" : {
- "text" : "Last updated at 2021-10-13 15:04:47 GMT"
- },
- "xAxis" : {
- "labels" : {
- "style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
- }
- },
- "type" : "category"
- },
- "yAxis" : {
- "title" : {
- "text" : null
- },
- "min" : 0
+ "text" : "Last updated at 2021-10-13 17:15:41 GMT"
},
"series" : [
{
"dataLabels" : {
- "enabled" : "true",
- "rotation" : -90,
- "align" : "right",
+ "y" : 10,
"style" : {
"fontFamily" : "Verdana, sans-serif",
"fontSize" : "13px"
},
- "y" : 10,
+ "rotation" : -90,
"color" : "#FFFFFF",
+ "align" : "right",
+ "enabled" : "true",
"format" : "{point.y:.0f}"
},
+ "name" : "Contributions",
"data" : [
[
"Blog",
@@ -44,19 +27,36 @@
],
[
"Perl",
- 6361
+ 6362
],
[
"Raku",
3899
]
- ],
- "name" : "Contributions"
+ ]
}
],
+ "yAxis" : {
+ "title" : {
+ "text" : null
+ },
+ "min" : 0
+ },
"title" : {
"text" : "The Weekly Challenge Contributions [2019 - 2021]"
},
+ "chart" : {
+ "type" : "column"
+ },
+ "xAxis" : {
+ "labels" : {
+ "style" : {
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
+ }
+ },
+ "type" : "category"
+ },
"tooltip" : {
"pointFormat" : "<b>{point.y:.0f}</b>"
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index 395009029f..36a271b06c 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,10 +1,8 @@
{
- "chart" : {
- "type" : "column"
- },
"drilldown" : {
"series" : [
{
+ "name" : "001",
"id" : "001",
"data" : [
[
@@ -19,11 +17,9 @@
"Blog",
11
]
- ],
- "name" : "001"
+ ]
},
{
- "id" : "002",
"data" : [
[
"Perl",
@@ -38,10 +34,10 @@
10
]
],
- "name" : "002"
+ "name" : "002",
+ "id" : "002"
},
{
- "name" : "003",
"data" : [
[
"Perl",
@@ -56,9 +52,11 @@
9
]
],
- "id" : "003"
+ "id" : "003",
+ "name" : "003"
},
{
+ "id" : "004",
"name" : "004",
"data" : [
[
@@ -73,10 +71,10 @@
"Blog",
10
]
- ],
- "id" : "004"
+ ]
},
{
+ "name" : "005",
"id" : "005",
"data" : [
[
@@ -91,11 +89,9 @@
"Blog",
12
]
- ],
- "name" : "005"
+ ]
},
{
- "name" : "006",
"data" : [
[
"Perl",
@@ -110,9 +106,11 @@
7
]
],
+ "name" : "006",
"id" : "006"
},
{
+ "name" : "007",
"id" : "007",
"data" : [
[
@@ -127,12 +125,9 @@
"Blog",
10
]
- ],
- "name" : "007"
+ ]
},
{
- "id" : "008",
- "name" : "008",
"data" : [
[
"Perl",
@@ -146,10 +141,13 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "008",
+ "id" : "008"
},
{
"name" : "009",
+ "id" : "009",
"data" : [
[
"Perl",
@@ -163,11 +161,11 @@
"Blog",
13
]
- ],
- "id" : "009"
+ ]
},
{
"id" : "010",
+ "name" : "010",
"data" : [
[
"Perl",
@@ -181,12 +179,9 @@
"Blog",
11
]
- ],
- "name" : "010"
+ ]
},
{
- "id" : "011",
- "name" : "011",
"data" : [
[
"Perl",
@@ -200,9 +195,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "011",
+ "name" : "011"
},
{
+ "name" : "012",
+ "id" : "012",
"data" : [
[
"Perl",
@@ -216,11 +215,10 @@
"Blog",
11
]
- ],
- "name" : "012",
- "id" : "012"
+ ]
},
{
+ "id" : "013",
"name" : "013",
"data" : [
[
@@ -235,8 +233,7 @@
"Blog",
13
]
- ],
- "id" : "013"
+ ]
},
{
"id" : "014",
@@ -257,8 +254,6 @@
]
},
{
- "id" : "015",
- "name" : "015",
"data" : [
[
"Perl",
@@ -272,7 +267,9 @@
"Blog",
15
]
- ]
+ ],
+ "name" : "015",
+ "id" : "015"
},
{
"data" : [
@@ -289,12 +286,10 @@
12
]
],
- "name" : "016",
- "id" : "016"
+ "id" : "016",
+ "name" : "016"
},
{
- "id" : "017",
- "name" : "017",
"data" : [
[
"Perl",
@@ -308,7 +303,9 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "017",
+ "name" : "017"
},
{
"data" : [
@@ -330,6 +327,7 @@
},
{
"name" : "019",
+ "id" : "019",
"data" : [
[
"Perl",
@@ -343,11 +341,9 @@
"Blog",
13
]
- ],
- "id" : "019"
+ ]
},
{
- "name" : "020",
"data" : [
[
"Perl",
@@ -362,9 +358,11 @@
13
]
],
- "id" : "020"
+ "id" : "020",
+ "name" : "020"
},
{
+ "id" : "021",
"name" : "021",
"data" : [
[
@@ -379,12 +377,9 @@
"Blog",
10
]
- ],
- "id" : "021"
+ ]
},
{
- "id" : "022",
- "name" : "022",
"data" : [
[
"Perl",
@@ -398,11 +393,11 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "022",
+ "id" : "022"
},
{
- "id" : "023",
- "name" : "023",
"data" : [
[
"Perl",
@@ -416,10 +411,11 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "023",
+ "name" : "023"
},
{
- "id" : "024",
"data" : [
[
"Perl",
@@ -434,10 +430,10 @@
11
]
],
+ "id" : "024",
"name" : "024"
},
{
- "id" : "025",
"data" : [
[
"Perl",
@@ -452,10 +448,12 @@
12
]
],
+ "id" : "025",
"name" : "025"
},
{
"name" : "026",
+ "id" : "026",
"data" : [
[
"Perl",
@@ -469,10 +467,10 @@
"Blog",
10
]
- ],
- "id" : "026"
+ ]
},
{
+ "name" : "027",
"id" : "027",
"data" : [
[
@@ -487,11 +485,9 @@
"Blog",
9
]
- ],
- "name" : "027"
+ ]
},
{
- "id" : "028",
"data" : [
[
"Perl",
@@ -506,10 +502,10 @@
9
]
],
+ "id" : "028",
"name" : "028"
},
{
- "id" : "029",
"data" : [
[
"Perl",
@@ -524,10 +520,12 @@
12
]
],
- "name" : "029"
+ "name" : "029",
+ "id" : "029"
},
{
"id" : "030",
+ "name" : "030",
"data" : [
[
"Perl",
@@ -541,11 +539,9 @@
"Blog",
10
]
- ],
- "name" : "030"
+ ]
},
{
- "id" : "031",
"data" : [
[
"Perl",
@@ -560,9 +556,12 @@
9
]
],
- "name" : "031"
+ "name" : "031",
+ "id" : "031"
},
{
+ "id" : "032",
+ "name" : "032",
"data" : [
[
"Perl",
@@ -576,11 +575,10 @@
"Blog",
10
]
- ],
- "name" : "032",
- "id" : "032"
+ ]
},
{
+ "name" : "033",
"id" : "033",
"data" : [
[
@@ -595,8 +593,7 @@
"Blog",
10
]
- ],
- "name" : "033"
+ ]
},
{
"data" : [
@@ -635,6 +632,7 @@
]
},
{
+ "id" : "036",
"name" : "036",
"data" : [
[
@@ -649,12 +647,11 @@
"Blog",
11
]
- ],
- "id" : "036"
+ ]
},
{
- "id" : "037",
"name" : "037",
+ "id" : "037",
"data" : [
[
"Perl",
@@ -671,7 +668,6 @@
]
},
{
- "name" : "038",
"data" : [
[
"Perl",
@@ -686,6 +682,7 @@
12
]
],
+ "name" : "038",
"id" : "038"
},
{
@@ -703,12 +700,10 @@
12
]
],
- "name" : "039",
- "id" : "039"
+ "id" : "039",
+ "name" : "039"
},
{
- "id" : "040",
- "name" : "040",
"data" : [
[
"Perl",
@@ -722,10 +717,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "040",
+ "name" : "040"
},
{
- "name" : "041",
"data" : [
[
"Perl",
@@ -740,9 +736,12 @@
9
]
],
- "id" : "041"
+ "id" : "041",
+ "name" : "041"
},
{
+ "name" : "042",
+ "id" : "042",
"data" : [
[
"Perl",
@@ -756,12 +755,9 @@
"Blog",
11
]
- ],
- "name" : "042",
- "id" : "042"
+ ]
},
{
- "id" : "043",
"data" : [
[
"Perl",
@@ -776,10 +772,10 @@
11
]
],
+ "id" : "043",
"name" : "043"
},
{
- "name" : "044",
"data" : [
[
"Perl",
@@ -794,7 +790,8 @@
11
]
],
- "id" : "044"
+ "id" : "044",
+ "name" : "044"
},
{
"data" : [
@@ -811,8 +808,8 @@
11
]
],
- "name" : "045",
- "id" : "045"
+ "id" : "045",
+ "name" : "045"
},
{
"id" : "046",
@@ -833,7 +830,6 @@
]
},
{
- "id" : "047",
"data" : [
[
"Perl",
@@ -848,11 +844,12 @@
10
]
],
+ "id" : "047",
"name" : "047"
},
{
- "id" : "048",
"name" : "048",
+ "id" : "048",
"data" : [
[
"Perl",
@@ -869,6 +866,7 @@
]
},
{
+ "id" : "049",
"name" : "049",
"data" : [
[
@@ -883,11 +881,9 @@
"Blog",
12
]
- ],
- "id" : "049"
+ ]
},
{
- "id" : "050",
"data" : [
[
"Perl",
@@ -902,9 +898,12 @@
12
]
],
+ "id" : "050",
"name" : "050"
},
{
+ "name" : "051",
+ "id" : "051",
"data" : [
[
"Perl",
@@ -918,12 +917,11 @@
"Blog",
11
]
- ],
- "name" : "051",
- "id" : "051"
+ ]
},
{
"name" : "052",
+ "id" : "052",
"data" : [
[
"Perl",
@@ -937,12 +935,9 @@
"Blog",
14
]
- ],
- "id" : "052"
+ ]
},
{
- "id" : "053",
- "name" : "053",
"data" : [
[
"Perl",
@@ -956,11 +951,11 @@
"Blog",
15
]
- ]
+ ],
+ "name" : "053",
+ "id" : "053"
},
{
- "id" : "054",
- "name" : "054",
"data" : [
[
"Perl",
@@ -974,10 +969,11 @@
"Blog",
18
]
- ]
+ ],
+ "name" : "054",
+ "id" : "054"
},
{
- "name" : "055",
"data" : [
[
"Perl",
@@ -992,10 +988,12 @@
14
]
],
+ "name" : "055",
"id" : "055"
},
{
"name" : "056",
+ "id" : "056",
"data" : [
[