aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2021-07-21 01:57:51 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2021-07-21 01:57:51 +0100
commitdf80d4f8f7600f5ae70b897036199e332be771d8 (patch)
tree5361c753e88171a2d73632d20b1794d6a0a7fbd6
parent1acbc7c88be908d1c3260fc1e8067b2cf4241cf1 (diff)
downloadperlweeklychallenge-club-df80d4f8f7600f5ae70b897036199e332be771d8.tar.gz
perlweeklychallenge-club-df80d4f8f7600f5ae70b897036199e332be771d8.tar.bz2
perlweeklychallenge-club-df80d4f8f7600f5ae70b897036199e332be771d8.zip
- Added solutions by Laurent Rosenfeld.
-rw-r--r--challenge-122/laurent-rosenfeld/blog.txt1
-rw-r--r--challenge-122/laurent-rosenfeld/perl/ch-1.pl10
-rw-r--r--challenge-122/laurent-rosenfeld/perl/ch-2.pl26
-rw-r--r--challenge-122/laurent-rosenfeld/raku/ch-1.raku8
-rw-r--r--challenge-122/laurent-rosenfeld/raku/ch-2.raku23
-rw-r--r--stats/pwc-current.json257
-rw-r--r--stats/pwc-language-breakdown-summary.json80
-rw-r--r--stats/pwc-language-breakdown.json862
-rw-r--r--stats/pwc-leaders.json348
-rw-r--r--stats/pwc-summary-1-30.json36
-rw-r--r--stats/pwc-summary-121-150.json110
-rw-r--r--stats/pwc-summary-151-180.json32
-rw-r--r--stats/pwc-summary-181-210.json96
-rw-r--r--stats/pwc-summary-211-240.json34
-rw-r--r--stats/pwc-summary-31-60.json38
-rw-r--r--stats/pwc-summary-61-90.json100
-rw-r--r--stats/pwc-summary-91-120.json102
-rw-r--r--stats/pwc-summary.json518
18 files changed, 1386 insertions, 1295 deletions
diff --git a/challenge-122/laurent-rosenfeld/blog.txt b/challenge-122/laurent-rosenfeld/blog.txt
new file mode 100644
index 0000000000..0c616545b8
--- /dev/null
+++ b/challenge-122/laurent-rosenfeld/blog.txt
@@ -0,0 +1 @@
+http://blogs.perl.org/users/laurent_r/2021/07/perl-weekly-challenge-122-average-of-stream-and-basketball-points.html
diff --git a/challenge-122/laurent-rosenfeld/perl/ch-1.pl b/challenge-122/laurent-rosenfeld/perl/ch-1.pl
new file mode 100644
index 0000000000..5b66714669
--- /dev/null
+++ b/challenge-122/laurent-rosenfeld/perl/ch-1.pl
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+use feature "say";
+
+my @n = (10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
+my @mvg_avg = ($n[0]);
+for my $i (1..9) {
+ $mvg_avg[$i] = ($mvg_avg[$i-1] * $i + $n[$i]) / ($i + 1);
+}
+say "@mvg_avg";
diff --git a/challenge-122/laurent-rosenfeld/perl/ch-2.pl b/challenge-122/laurent-rosenfeld/perl/ch-2.pl
new file mode 100644
index 0000000000..f05f7a444b
--- /dev/null
+++ b/challenge-122/laurent-rosenfeld/perl/ch-2.pl
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use feature "say";
+
+my $target = shift // 5;
+my @vals = (1, 2, 3);
+
+sub find_dist {
+ my ($sum, @seq) = @_;
+ for my $i (@vals) {
+ my $new_sum = $sum + $i;
+ # if $new_sum > $target, then we don't
+ # need to test other values of @vals and
+ # can use return instead of next
+ # since these values are in ascending order
+ return if $new_sum > $target;
+ my @new_seq = (@seq, $i);
+ if ($new_sum == $target) {
+ say ""@new_seq";
+ return;
+ } else {
+ find_dist($new_sum, @new_seq);
+ }
+ }
+}
+find_dist 0, ();
diff --git a/challenge-122/laurent-rosenfeld/raku/ch-1.raku b/challenge-122/laurent-rosenfeld/raku/ch-1.raku
new file mode 100644
index 0000000000..6dc7f29d8e
--- /dev/null
+++ b/challenge-122/laurent-rosenfeld/raku/ch-1.raku
@@ -0,0 +1,8 @@
+use v6;
+
+my @n = 10, 20 ... Inf;
+my @cum_moving_avg = @n[0];
+for 1..^10 -> $i {
+ @cum_moving_avg[$i] = (@cum_moving_avg[$i-1] * $i + @n[$i]) / ($i + 1);
+}
+say ~@cum_moving_avg;
diff --git a/challenge-122/laurent-rosenfeld/raku/ch-2.raku b/challenge-122/laurent-rosenfeld/raku/ch-2.raku
new file mode 100644
index 0000000000..f85c63338a
--- /dev/null
+++ b/challenge-122/laurent-rosenfeld/raku/ch-2.raku
@@ -0,0 +1,23 @@
+use v6;
+
+my $target = @*ARGS[0] // 5;
+my @vals = 1, 2, 3;
+
+sub find-dist ($sum, @seq) {
+ for @vals -> $i {
+ my $new-sum = $sum + $i;
+ # if $new-sum > $target, then we don't
+ # need to test other values of @vals and
+ # can use return directly instead of next
+ # since these values are in ascending order
+ return if $new-sum > $target;
+ my @new-seq = |@seq, $i;
+ if $new-sum == $target {
+ say ~@new-seq;
+ return;
+ } else {
+ find-dist($new-sum, @new-seq);
+ }
+ }
+}
+find-dist 0, ();
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 10f3cf59aa..741763f160 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,120 +1,25 @@
{
- "subtitle" : {
- "text" : "[Champions: 12] Last updated at 2021-07-20 17:05:39 GMT"
- },
- "chart" : {
- "type" : "column"
- },
- "title" : {
- "text" : "The Weekly Challenge - 122"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "legend" : {
- "enabled" : 0
- },
- "series" : [
- {
- "data" : [
- {
- "y" : 2,
- "drilldown" : "Cheok-Yin Fung",
- "name" : "Cheok-Yin Fung"
- },
- {
- "name" : "Dave Jacoby",
- "drilldown" : "Dave Jacoby",
- "y" : 3
- },
- {
- "y" : 3,
- "name" : "James Smith",
- "drilldown" : "James Smith"
- },
- {
- "y" : 4,
- "drilldown" : "Luca Ferrari",
- "name" : "Luca Ferrari"
- },
- {
- "drilldown" : "Lucas Ransan",
- "name" : "Lucas Ransan",
- "y" : 2
- },
- {
- "y" : 2,
- "name" : "Mark Anderson",
- "drilldown" : "Mark Anderson"
- },
- {
- "drilldown" : "Niels van Dijke",
- "name" : "Niels van Dijke",
- "y" : 2
- },
- {
- "name" : "Peter Scott",
- "drilldown" : "Peter Scott",
- "y" : 1
- },
- {
- "y" : 3,
- "drilldown" : "Roger Bell_West",
- "name" : "Roger Bell_West"
- },
- {
- "y" : 4,
- "drilldown" : "Stuart Little",
- "name" : "Stuart Little"
- },
- {
- "drilldown" : "Ulrich Rieke",
- "name" : "Ulrich Rieke",
- "y" : 3
- },
- {
- "y" : 3,
- "name" : "W. Luis Mochan",
- "drilldown" : "W. Luis Mochan"
- }
- ],
- "name" : "The Weekly Challenge - 122",
- "colorByPoint" : 1
- }
- ],
"tooltip" : {
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
"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/>"
},
- "plotOptions" : {
- "series" : {
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- },
- "borderWidth" : 0
- }
- },
"xAxis" : {
"type" : "category"
},
"drilldown" : {
"series" : [
{
- "name" : "Cheok-Yin Fung",
+ "id" : "Cheok-Yin Fung",
"data" : [
[
"Perl",
2
]
],
- "id" : "Cheok-Yin Fung"
+ "name" : "Cheok-Yin Fung"
},
{
- "name" : "Dave Jacoby",
"id" : "Dave Jacoby",
"data" : [
[
@@ -125,7 +30,8 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "Dave Jacoby"
},
{
"data" : [
@@ -138,11 +44,28 @@
1
]
],
- "id" : "James Smith",
- "name" : "James Smith"
+ "name" : "James Smith",
+ "id" : "James Smith"
+ },
+ {
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Raku",
+ 2
+ ],
+ [
+ "Blog",
+ 1
+ ]
+ ],
+ "name" : "Laurent Rosenfeld",
+ "id" : "Laurent Rosenfeld"
},
{
- "id" : "Luca Ferrari",
"data" : [
[
"Raku",
@@ -153,16 +76,17 @@
2
]
],
- "name" : "Luca Ferrari"
+ "name" : "Luca Ferrari",
+ "id" : "Luca Ferrari"
},
{
- "name" : "Lucas Ransan",
"data" : [
[
"Raku",
2
]
],
+ "name" : "Lucas Ransan",
"id" : "Lucas Ransan"
},
{
@@ -176,27 +100,26 @@
"name" : "Mark Anderson"
},
{
- "name" : "Niels van Dijke",
"id" : "Niels van Dijke",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "Niels van Dijke"
},
{
- "name" : "Peter Scott",
"id" : "Peter Scott",
"data" : [
[
"Perl",
1
]
- ]
+ ],
+ "name" : "Peter Scott"
},
{
- "name" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -207,9 +130,11 @@
1
]
],
+ "name" : "Roger Bell_West",
"id" : "Roger Bell_West"
},
{
+ "name" : "Stuart Little",
"data" : [
[
"Perl",
@@ -220,12 +145,9 @@
2
]
],
- "id" : "Stuart Little",
- "name" : "Stuart Little"
+ "id" : "Stuart Little"
},
{
- "name" : "Ulrich Rieke",
- "id" : "Ulrich Rieke",
"data" : [
[
"Perl",
@@ -235,11 +157,11 @@
"Raku",
1
]
- ]
+ ],
+ "name" : "Ulrich Rieke",
+ "id" : "Ulrich Rieke"
},
{
- "name" : "W. Luis Mochan",
- "id" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -249,8 +171,109 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "W. Luis Mochan",
+ "id" : "W. Luis Mochan"
}
]
+ },
+ "title" : {
+ "text" : "The Weekly Challenge - 122"
+ },
+ "legend" : {
+ "enabled" : 0
+ },
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ }
+ }
+ },
+ "series" : [
+ {
+ "data" : [
+ {
+ "name" : "Cheok-Yin Fung",
+ "y" : 2,
+ "drilldown" : "Cheok-Yin Fung"
+ },
+ {
+ "name" : "Dave Jacoby",
+ "drilldown" : "Dave Jacoby",
+ "y" : 3
+ },
+ {
+ "drilldown" : "James Smith",
+ "y" : 3,
+ "name" : "James Smith"
+ },
+ {
+ "name" : "Laurent Rosenfeld",
+ "drilldown" : "Laurent Rosenfeld",
+ "y" : 5
+ },
+ {
+ "drilldown" : "Luca Ferrari",
+ "y" : 4,
+ "name" : "Luca Ferrari"
+ },
+ {
+ "drilldown" : "Lucas Ransan",
+ "y" : 2,
+ "name" : "Lucas Ransan"
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Mark Anderson",
+ "name" : "Mark Anderson"
+ },
+ {
+ "drilldown" : "Niels van Dijke",
+ "y" : 2,
+ "name" : "Niels van Dijke"
+ },
+ {
+ "drilldown" : "Peter Scott",
+ "y" : 1,
+ "name" : "Peter Scott"
+ },
+ {
+ "y" : 3,
+ "drilldown" : "Roger Bell_West",
+ "name" : "Roger Bell_West"
+ },
+ {
+ "y" : 4,
+ "drilldown" : "Stuart Little",
+ "name" : "Stuart Little"
+ },
+ {
+ "name" : "Ulrich Rieke",
+ "drilldown" : "Ulrich Rieke",
+ "y" : 3
+ },
+ {
+ "drilldown" : "W. Luis Mochan",
+ "y" : 3,
+ "name" : "W. Luis Mochan"
+ }
+ ],
+ "name" : "The Weekly Challenge - 122",
+ "colorByPoint" : 1
+ }
+ ],
+ "chart" : {
+ "type" : "column"
+ },
+ "subtitle" : {
+ "text" : "[Champions: 13] Last updated at 2021-07-21 00:57:30 GMT"
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 30110526bc..72cbc66c31 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -2,62 +2,62 @@
"legend" : {
"enabled" : "false"
},
- "series" : [
- {
- "name" : "Contributions",
- "data" : [
- [
- "Blog",
- 1739
- ],
- [
- "Perl",
- 5819
- ],
- [
- "Raku",
- 3635
- ]
- ],
- "dataLabels" : {
- "enabled" : "true",
- "format" : "{point.y:.0f}",
- "y" : 10,
- "color" : "#FFFFFF",
- "align" : "right",
- "rotation" : -90,
- "style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
- }
- }
- }
- ],
"tooltip" : {
"pointFormat" : "<b>{point.y:.0f}</b>"
},
"xAxis" : {
+ "type" : "category",
"labels" : {
"style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
}
- },
- "type" : "category"
+ }
},
"title" : {
"text" : "The Weekly Challenge Contributions [2019 - 2021]"
},
+ "subtitle" : {
+ "text" : "Last updated at 2021-07-21 00:57:30 GMT"
+ },
"yAxis" : {
+ "min" : 0,
"title" : {
"text" : null
- },
- "min" : 0
+ }
},
+ "series" : [
+ {
+ "dataLabels" : {
+ "color" : "#FFFFFF",
+ "format" : "{point.y:.0f}",
+ "rotation" : -90,
+ "align" : "right",
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ },
+ "y" : 10,
+ "enabled" : "true"
+ },
+ "name" : "Contributions",
+ "data" : [
+ [
+ "Blog",
+ 1740
+ ],
+ [
+ "Perl",
+ 5821
+ ],
+ [
+ "Raku",
+ 3637
+ ]
+ ]
+ }
+ ],
"chart" : {
"type" : "column"
- },
- "subtitle" : {
- "text" : "Last updated at 2021-07-20 17:05:39 GMT"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index 6507147965..9e2746b90c 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,23 +1,13 @@
{
+ "legend" : {
+ "enabled" : "false"
+ },
"title" : {
"text" : "The Weekly Challenge Language"
},
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2021-07-20 17:05:39 GMT"
- },
- "chart" : {
- "type" : "column"
- },
"drilldown" : {
"series" : [
{
- "name" : "001",
- "id" : "001",
"data" : [
[
"Perl",
@@ -31,11 +21,12 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "001",
+ "id" : "001"
},
{
"name" : "002",
- "id" : "002",
"data" : [
[
"Perl",
@@ -49,10 +40,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "002"
},
{
- "id" : "003",
+ "name" : "003",
"data" : [
[
"Perl",
@@ -67,10 +59,9 @@
9
]
],
- "name" : "003"
+ "id" : "003"
},
{
- "name" : "004",
"id" : "004",
"data" : [
[
@@ -85,7 +76,8 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "004"
},
{
"name" : "005",
@@ -106,6 +98,7 @@
"id" : "005"
},
{
+ "id" : "006",
"data" : [
[
"Perl",
@@ -120,10 +113,10 @@
7
]
],
- "id" : "006",
"name" : "006"
},
{
+ "id" : "007",
"data" : [
[
"Perl",
@@ -138,7 +131,6 @@
10
]
],
- "id" : "007",
"name" : "007"
},
{
@@ -160,6 +152,7 @@
"id" : "008"
},
{
+ "id" : "009",
"name" : "009",
"data" : [
[
@@ -174,12 +167,10 @@
"Blog",
13
]
- ],
- "id" : "009"
+ ]
},
{
"name" : "010",
- "id" : "010",
"data" : [
[
"Perl",
@@ -193,10 +184,10 @@
"Blog",
11
]
- ]
+ ],
+ "id" : "010"
},
{
- "name" : "011",
"id" : "011",
"data" : [
[
@@ -211,9 +202,11 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "011"
},
{
+ "id" : "012",
"name" : "012",
"data" : [
[
@@ -228,11 +221,9 @@
"Blog",
11
]
- ],
- "id" : "012"
+ ]
},
{
- "id" : "013",
"data" : [
[
"Perl",
@@ -247,10 +238,11 @@
13
]
],
- "name" : "013"
+ "name" : "013",
+ "id" : "013"
},
{
- "id" : "014",
+ "name" : "014",
"data" : [
[
"Perl",
@@ -265,9 +257,10 @@
15
]
],
- "name" : "014"
+ "id" : "014"
},
{
+ "id" : "015",
"data" : [
[
"Perl",
@@ -282,10 +275,11 @@
15
]
],
- "id" : "015",
"name" : "015"
},
{
+ "id" : "016",
+ "name" : "016",
"data" : [
[
"Perl",
@@ -299,12 +293,10 @@
"Blog",
12
]
- ],
- "id" : "016",
- "name" : "016"
+ ]
},
{
- "id" : "017",
+ "name" : "017",
"data" : [
[
"Perl",
@@ -319,9 +311,11 @@
12
]
],
- "name" : "017"
+ "id" : "017"
},
{
+ "id" : "018",
+ "name" : "018",
"data" : [
[
"Perl",
@@ -335,11 +329,10 @@
"Blog",
14
]
- ],
- "id" : "018",
- "name" : "018"
+ ]
},
{
+ "id" : "019",
"name" : "019",
"data" : [
[
@@ -354,8 +347,7 @@
"Blog",
13
]
- ],
- "id" : "019"
+ ]
},
{
"id" : "020",
@@ -377,6 +369,7 @@
},
{
"id" : "021",
+ "name" : "021",
"data" : [
[
"Perl",
@@ -390,11 +383,9 @@
"Blog",
10
]
- ],
- "name" : "021"
+ ]
},
{
- "id" : "022",
"data" : [
[
"Perl",
@@ -409,9 +400,11 @@
10
]
],
- "name" : "022"
+ "name" : "022",
+ "id" : "022"
},
{
+ "id" : "023",
"data" : [
[
"Perl",
@@ -426,10 +419,10 @@
12
]
],
- "id" : "023",
"name" : "023"
},
{
+ "id" : "024",
"data" : [
[
"Perl",
@@ -444,7 +437,6 @@
11
]
],
- "id" : "024",
"name" : "024"
},
{
@@ -462,10 +454,11 @@
12
]
],
- "id" : "025",
- "name" : "025"
+ "name" : "025",
+ "id" : "025"
},
{
+ "id" : "026",
"data" : [
[
"Perl",
@@ -480,11 +473,9 @@
10
]
],
- "id" : "026",
"name" : "026"
},
{
- "name" : "027",
"data" : [
[
"Perl",
@@ -499,9 +490,11 @@
9
]
],
+ "name" : "027",
"id" : "027"
},
{
+ "id" : "028",
"name" : "028",
"data" : [
[
@@ -516,11 +509,10 @@
"Blog",
9
]
- ],
- "id" : "028"
+ ]
},
{
- "id" : "029",
+ "name" : "029",
"data" : [
[
"Perl",
@@ -535,11 +527,11 @@
12
]
],
- "name" : "029"
+ "id" : "029"
},
{
- "name" : "030",
"id" : "030",
+ "name" : "030",
"data" : [
[
"Perl",
@@ -556,6 +548,8 @@
]
},
{
+ "id" : "031",
+ "name" : "031",
"data" : [
[
"Perl",
@@ -569,11 +563,10 @@
"Blog",
9
]
- ],
- "id" : "031",
- "name" : "031"
+ ]
},
{
+ "id" : "032",
"data" : [
[
"Perl",
@@ -588,10 +581,11 @@
10
]
],
- "id" : "032",
"name" : "032"
},
{
+ "id" : "033",
+ "name" : "033",
"data" : [
[
"Perl",
@@ -605,11 +599,11 @@
"Blog",
10
]
- ],
- "id" : "033",
- "name" : "033"
+ ]
},
{
+ "id" : "034",
+ "name" : "034",
"data" : [
[
"Perl",
@@ -623,12 +617,9 @@
"Blog",
11
]
- ],
- "id" : "034",
- "name" : "034"
+ ]
},
{
- "name" : "035",
"data" : [
[
"Perl",
@@ -643,11 +634,10 @@
9
]
],
+ "name" : "035",
"id" : "035"
},
{
- "name" : "036",
- "id" : "036",
"data" : [
[
"Perl",
@@ -661,11 +651,12 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "036",
+ "id" : "036"
},
{
"name" : "037",
- "id" : "037",
"data" : [
[
"Perl",
@@ -679,9 +670,11 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "037"
},
{
+ "id" : "038",
"name" : "038",
"data" : [
[
@@ -696,8 +689,7 @@
"Blog",
12
]
- ],
- "id" : "038"
+ ]
},
{
"data" : [
@@ -714,8 +706,8 @@
12
]
],
- "id" : "039",
- "name" : "039"
+ "name" : "039",
+ "id" : "039"
},
{
"data" : [
@@ -732,10 +724,11 @@
10