aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2023-12-06 21:50:45 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2023-12-06 21:50:45 +0000
commit55e35b727a9bc6f0e9dc2f8df4f53effa3813e14 (patch)
treeb57fb0e5022e1f3eb9a04b3efd78df5e22ba3430
parente3ae5467460c6dda81f38390e2bd4cefa24bc781 (diff)
downloadperlweeklychallenge-club-55e35b727a9bc6f0e9dc2f8df4f53effa3813e14.tar.gz
perlweeklychallenge-club-55e35b727a9bc6f0e9dc2f8df4f53effa3813e14.tar.bz2
perlweeklychallenge-club-55e35b727a9bc6f0e9dc2f8df4f53effa3813e14.zip
- Added solutions by Laurent Rosenfeld.
- Added solutions by Robert DiCicco. - Added solutions by Thomas Kohler.
-rw-r--r--challenge-246/laurent-rosenfeld/blog1.txt1
-rw-r--r--challenge-246/laurent-rosenfeld/perl/ch-2.pl26
-rw-r--r--challenge-246/laurent-rosenfeld/raku/ch-2.raku21
-rw-r--r--challenge-246/robert-dicicco/raku/ch-1.raku29
-rw-r--r--stats/pwc-current.json185
-rw-r--r--stats/pwc-language-breakdown-summary.json62
-rw-r--r--stats/pwc-language-breakdown.json1736
-rw-r--r--stats/pwc-leaders.json756
-rw-r--r--stats/pwc-summary-1-30.json92
-rw-r--r--stats/pwc-summary-121-150.json100
-rw-r--r--stats/pwc-summary-151-180.json120
-rw-r--r--stats/pwc-summary-181-210.json90
-rw-r--r--stats/pwc-summary-211-240.json94
-rw-r--r--stats/pwc-summary-241-270.json38
-rw-r--r--stats/pwc-summary-271-300.json110
-rw-r--r--stats/pwc-summary-301-330.json46
-rw-r--r--stats/pwc-summary-31-60.json46
-rw-r--r--stats/pwc-summary-61-90.json106
-rw-r--r--stats/pwc-summary-91-120.json118
-rw-r--r--stats/pwc-summary.json658
20 files changed, 2267 insertions, 2167 deletions
diff --git a/challenge-246/laurent-rosenfeld/blog1.txt b/challenge-246/laurent-rosenfeld/blog1.txt
new file mode 100644
index 0000000000..0e28fd88c0
--- /dev/null
+++ b/challenge-246/laurent-rosenfeld/blog1.txt
@@ -0,0 +1 @@
+https://blogs.perl.org/users/laurent_r/2023/12/perl-weekly-challenge-246-linear-recurrence-of-second-order.html
diff --git a/challenge-246/laurent-rosenfeld/perl/ch-2.pl b/challenge-246/laurent-rosenfeld/perl/ch-2.pl
new file mode 100644
index 0000000000..fa464dfdcf
--- /dev/null
+++ b/challenge-246/laurent-rosenfeld/perl/ch-2.pl
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use feature 'say';
+
+sub linear_rec {
+ my @in = @_;
+ my ($min, $max) = (sort {$a <=> $b} @in)[0, -1];
+ for my $p ($min .. $max) {
+ for my $q ($min .. $max) {
+ for my $i (2..$#in) {
+ last if $in[$i] !=
+ $p * $in[$i-2] + $q * $in[$i-1];
+ # say "$p $q $i";
+ return ("True: p = $p, q = $q")
+ if $i == $#in;
+ }
+ }
+ }
+ return "False";
+}
+
+my @tests = ([<1 1 2 3 5>], [<4 2 4 5 7>], [<4 1 2 -3 8>]);
+for my $test (@tests) {
+ printf "%-12s => ", "@$test";
+ say linear_rec @$test;
+}
diff --git a/challenge-246/laurent-rosenfeld/raku/ch-2.raku b/challenge-246/laurent-rosenfeld/raku/ch-2.raku
new file mode 100644
index 0000000000..9938c4a782
--- /dev/null
+++ b/challenge-246/laurent-rosenfeld/raku/ch-2.raku
@@ -0,0 +1,21 @@
+sub linear-rec (@in) {
+ my @range = @in.minmax;
+ for @range -> $p {
+ for @range -> $q {
+ for 2..@in.end -> $i {
+ last if @in[$i] !=
+ $p * @in[$i-2] + $q * @in[$i-1];
+ # say "$p $q $i";
+ return ("True: p = $p, q = $q")
+ if $i == @in.end;
+ }
+ }
+ }
+ return (False);
+}
+
+my @tests = <1 1 2 3 5>, <4 2 4 5 7>, <4 1 2 -3 8>;
+for @tests -> @test {
+ printf "%-12s => ", "@test[]";
+ say linear-rec @test;
+}
diff --git a/challenge-246/robert-dicicco/raku/ch-1.raku b/challenge-246/robert-dicicco/raku/ch-1.raku
new file mode 100644
index 0000000000..e4ad5a0a78
--- /dev/null
+++ b/challenge-246/robert-dicicco/raku/ch-1.raku
@@ -0,0 +1,29 @@
+#!/usr/bin/env raku
+=begin comment
+-------------------------------------
+AUTHOR: Robert DiCicco
+DATE : 2023-12-06
+Challenge 246 6 Out of 49 ( Raku )
+-------------------------------------
+=end comment
+
+use v6;
+
+my $cnt = 0;
+my @out = ();
+while 1 == 1 {
+ my $num = 49.rand.Int;
+ if $num > 0 {
+ @out.push: $num;
+ $cnt++;
+ }
+ last if $cnt == 6;
+}
+say @out.sort;
+
+=begin comment
+-------------------------------------
+SAMPLE OUTPUT
+(3 15 25 27 29 42)
+-------------------------------------
+=end comment
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 9c5019eb6b..92be346ec0 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,22 +1,27 @@
{
+ "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/>"
+ },
"series" : [
{
- "name" : "The Weekly Challenge - 246",
+ "colorByPoint" : 1,
"data" : [
{
- "drilldown" : "Bob Lied",
"name" : "Bob Lied",
- "y" : 3
+ "y" : 3,
+ "drilldown" : "Bob Lied"
},
{
+ "drilldown" : "Cheok-Yin Fung",
"y" : 3,
- "name" : "Cheok-Yin Fung",
- "drilldown" : "Cheok-Yin Fung"
+ "name" : "Cheok-Yin Fung"
},
{
+ "name" : "Dave Jacoby",
"y" : 3,
- "drilldown" : "Dave Jacoby",
- "name" : "Dave Jacoby"
+ "drilldown" : "Dave Jacoby"
},
{
"name" : "David Ferrone",
@@ -24,39 +29,39 @@
"y" : 2
},
{
- "y" : 2,
+ "name" : "E. Choroba",
"drilldown" : "E. Choroba",
- "name" : "E. Choroba"
+ "y" : 2
},
{
- "y" : 2,
"drilldown" : "Humberto Massa",
+ "y" : 2,
"name" : "Humberto Massa"
},
{
- "y" : 3,
"name" : "Laurent Rosenfeld",
+ "y" : 6,
"drilldown" : "Laurent Rosenfeld"
},
{
"name" : "Luca Ferrari",
- "drilldown" : "Luca Ferrari",
- "y" : 10
+ "y" : 10,
+ "drilldown" : "Luca Ferrari"
},
{
- "y" : 2,
"name" : "Mark Anderson",
- "drilldown" : "Mark Anderson"
+ "drilldown" : "Mark Anderson",
+ "y" : 2
},
{
"y" : 2,
- "name" : "Niels van Dijke",
- "drilldown" : "Niels van Dijke"
+ "drilldown" : "Niels van Dijke",
+ "name" : "Niels van Dijke"
},
{
- "y" : 1,
+ "name" : "Oliver Oviedo",
"drilldown" : "Oliver Oviedo",
- "name" : "Oliver Oviedo"
+ "y" : 1
},
{
"y" : 5,
@@ -69,18 +74,23 @@
"name" : "Peter Campbell Smith"
},
{
- "drilldown" : "Peter Meszaros",
"name" : "Peter Meszaros",
+ "drilldown" : "Peter Meszaros",
"y" : 2
},
{
- "name" : "Robert DiCicco",
+ "y" : 2,
"drilldown" : "Robert DiCicco",
- "y" : 1
+ "name" : "Robert DiCicco"
},
{
- "drilldown" : "Roger Bell_West",
"name" : "Roger Bell_West",
+ "drilldown" : "Roger Bell_West",
+ "y" : 4
+ },
+ {
+ "name" : "Thomas Kohler",
+ "drilldown" : "Thomas Kohler",
"y" : 4
},
{
@@ -89,21 +99,39 @@
"y" : 3
}
],
- "colorByPoint" : 1
+ "name" : "The Weekly Challenge - 246"
}
],
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "legend" : {
+ "enabled" : 0
+ },
+ "title" : {
+ "text" : "The Weekly Challenge - 246"
+ },
"plotOptions" : {
"series" : {
- "borderWidth" : 0,
"dataLabels" : {
- "format" : "{point.y}",
- "enabled" : 1
- }
+ "enabled" : 1,
+ "format" : "{point.y}"
+ },
+ "borderWidth" : 0
}
},
+ "subtitle" : {
+ "text" : "[Champions: 18] Last updated at 2023-12-06 21:48:05 GMT"
+ },
"drilldown" : {
"series" : [
{
+ "name" : "Bob Lied",
"data" : [
[
"Perl",
@@ -114,10 +142,11 @@
1
]
],
- "id" : "Bob Lied",
- "name" : "Bob Lied"
+ "id" : "Bob Lied"
},
{
+ "id" : "Cheok-Yin Fung",
+ "name" : "Cheok-Yin Fung",
"data" : [
[
"Perl",
@@ -127,13 +156,10 @@
"Blog",
1
]
- ],
- "id" : "Cheok-Yin Fung",
- "name" : "Cheok-Yin Fung"
+ ]
},
{
"name" : "Dave Jacoby",
- "id" : "Dave Jacoby",
"data" : [
[
"Perl",
@@ -143,54 +169,55 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "Dave Jacoby"
},
{
"id" : "David Ferrone",
- "name" : "David Ferrone",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "David Ferrone"
},
{
+ "id" : "E. Choroba",
"data" : [
[
"Perl",
2
]
],
- "id" : "E. Choroba",
"name" : "E. Choroba"
},
{
- "id" : "Humberto Massa",
"name" : "Humberto Massa",
"data" : [
[
"Raku",
2
]
- ]
+ ],
+ "id" : "Humberto Massa"
},
{
+ "name" : "Laurent Rosenfeld",
"data" : [
[
"Perl",
- 1
+ 2
],
[
"Raku",
- 1
+ 2
],
[
"Blog",
- 1
+ 2
]
],
- "name" : "Laurent Rosenfeld",
"id" : "Laurent Rosenfeld"
},
{
@@ -204,8 +231,8 @@
8
]
],
- "id" : "Luca Ferrari",
- "name" : "Luca Ferrari"
+ "name" : "Luca Ferrari",
+ "id" : "Luca Ferrari"
},
{
"data" : [
@@ -218,24 +245,24 @@
"id" : "Mark Anderson"
},
{
+ "id" : "Niels van Dijke",
"data" : [
[
"Perl",
2
]
],
- "id" : "Niels van Dijke",
"name" : "Niels van Dijke"
},
{
"id" : "Oliver Oviedo",
- "name" : "Oliver Oviedo",
"data" : [
[
"Perl",
1
]
- ]
+ ],
+ "name" : "Oliver Oviedo"
},
{
"data" : [
@@ -252,10 +279,12 @@
1
]
],
- "id" : "Packy Anderson",
- "name" : "Packy Anderson"
+ "name" : "Packy Anderson",
+ "id" : "Packy Anderson"
},
{
+ "id" : "Peter Campbell Smith",
+ "name" : "Peter Campbell Smith",
"data" : [
[
"Perl",
@@ -265,9 +294,7 @@
"Blog",
1
]
- ],
- "id" : "Peter Campbell Smith",
- "name" : "Peter Campbell Smith"
+ ]
},
{
"data" : [
@@ -276,20 +303,25 @@
2
]
],
- "id" : "Peter Meszaros",
- "name" : "Peter Meszaros"
+ "name" : "Peter Meszaros",
+ "id" : "Peter Meszaros"
},
{
"id" : "Robert DiCicco",
- "name" : "Robert DiCicco",
"data" : [
[
"Perl",
1
+ ],
+ [
+ "Raku",
+ 1
]
- ]
+ ],
+ "name" : "Robert DiCicco"
},
{
+ "name" : "Roger Bell_West",
"data" : [
[
"Perl",
@@ -300,7 +332,6 @@
2
]
],
- "name" : "Roger Bell_West",
"id" : "Roger Bell_West"
},
{
@@ -311,6 +342,20 @@
],
[
"Blog",
+ 2
+ ]
+ ],
+ "name" : "Thomas Kohler",
+ "id" : "Thomas Kohler"
+ },
+ {
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Blog",
1
]
],
@@ -319,29 +364,7 @@
}
]
},
- "subtitle" : {
- "text" : "[Champions: 17] Last updated at 2023-12-06 11:02:24 GMT"
- },
- "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/>"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
"chart" : {
"type" : "column"
- },
- "xAxis" : {
- "type" : "category"
- },
- "legend" : {
- "enabled" : 0
- },
- "title" : {
- "text" : "The Weekly Challenge - 246"
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 7fc5e8d381..b97c4faaef 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,15 +1,6 @@
{
- "xAxis" : {
- "type" : "category",
- "labels" : {
- "style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
- }
- }
- },
- "chart" : {
- "type" : "column"
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
},
"yAxis" : {
"min" : 0,
@@ -17,47 +8,56 @@
"text" : null
}
},
- "subtitle" : {
- "text" : "Last updated at 2023-12-06 11:02:24 GMT"
- },
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
- },
"series" : [
{
"dataLabels" : {
"align" : "right",
- "format" : "{point.y:.0f}",
- "y" : 10,
"color" : "#FFFFFF",
- "rotation" : -90,
- "enabled" : "true",
"style" : {
- "fontSize" : "13px",
- "fontFamily" : "Verdana, sans-serif"
- }
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ },
+ "y" : 10,
+ "enabled" : "true",
+ "format" : "{point.y:.0f}",
+ "rotation" : -90
},
+ "name" : "Contributions",
"data" : [
[
"Blog",
- 4276
+ 4279
],
[
"Perl",
- 12694
+ 12697
],
[
"Raku",
- 7320
+ 7322
]
- ],
- "name" : "Contributions"
+ ]
}
],
+ "legend" : {
+ "enabled" : "false"
+ },
+ "xAxis" : {
+ "labels" : {
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ }
+ },
+ "type" : "category"
+ },
"title" : {
"text" : "The Weekly Challenge Contributions [2019 - 2023]"
},
- "legend" : {
- "enabled" : "false"
+ "subtitle" : {
+ "text" : "Last updated at 2023-12-06 21:48:05 GMT"
+ },
+ "chart" : {
+ "type" : "column"
}
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index be234dd0af..601ec2d319 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,20 +1,8 @@
{
- "xAxis" : {
- "type" : "category"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
- },
- "chart" : {
- "type" : "column"
- },
"drilldown" : {
"series" : [
{
"id" : "001",
- "name" : "001",
"data" : [
[
"Perl",
@@ -28,9 +16,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "001"
},
{
+ "id" : "002",
"data" : [
[
"Perl",
@@ -45,7 +35,6 @@
10
]
],
- "id" : "002",
"name" : "002"
},
{
@@ -63,10 +52,12 @@
9
]
],
- "id" : "003",
- "name" : "003"
+ "name" : "003",
+ "id" : "003"
},
{
+ "id" : "004",
+ "name" : "004",
"data" : [
[
"Perl",
@@ -80,13 +71,9 @@
"Blog",
10
]
- ],
- "name" : "004",
- "id" : "004"
+ ]
},
{
- "id" : "005",
- "name" : "005",
"data" : [
[
"Perl",
@@ -100,10 +87,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "005",
+ "id" : "005"
},
{
- "id" : "006",
"name" : "006",
"data" : [
[
@@ -118,7 +106,8 @@
"Blog",
7
]
- ]
+ ],
+ "id" : "006"
},
{
"data" : [
@@ -139,6 +128,7 @@
"id" : "007"
},
{
+ "name" : "008",
"data" : [
[
"Perl",
@@ -153,10 +143,11 @@
12
]
],
- "name" : "008",
"id" : "008"
},
{
+ "id" : "009",
+ "name" : "009",
"data" : [
[
"Perl",
@@ -170,13 +161,10 @@
"Blog",
13
]
- ],
- "id" : "009",
- "name" : "009"
+ ]
},
{
"id" : "010",
- "name" : "010",
"data" : [
[
"Perl",
@@ -190,11 +178,11 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "010"
},
{
"name" : "011",
- "id" : "011",
"data" : [
[
"Perl",
@@ -208,11 +196,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "011"
},
{
"name" : "012",
- "id" : "012",
"data" : [
[
"Perl",
@@ -226,11 +214,10 @@
"Blog",
11
]
- ]
+ ],
+ "id" : "012"
},
{
- "id" : "013",
- "name" : "013",
"data" : [
[
"Perl",
@@ -244,9 +231,13 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "013",
+ "id" : "013"
},
{
+ "id" : "014",
+ "name" : "014",
"data" : [
[
"Perl",
@@ -260,11 +251,10 @@
"Blog",
15
]
- ],
- "name" : "014",
- "id" : "014"
+ ]
},
{
+ "name" : "015",
"data" : [
[
"Perl",
@@ -279,12 +269,11 @@
15
]
],
- "id" : "015",
- "name" : "015"
+ "id" : "015"
},
{
- "name" : "016",
"id" : "016",
+ "name" : "016",
"data" : [
[
"Perl",
@@ -301,7 +290,6 @@
]
},
{
- "name" : "017",
"id" : "017",
"data" : [
[
@@ -316,9 +304,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "017"
},
{
+ "name" : "018",
"data" : [
[
"Perl",
@@ -333,10 +323,10 @@
14
]
],
- "name" : "018",
"id" : "018"
},
{
+ "name" : "019",
"data" : [
[
"Perl",
@@ -351,12 +341,9 @@
13
]
],
- "name" : "019",
"id" : "019"
},
{
- "id" : "020",
- "name" : "020",
"data" : [
[
"Perl",
@@ -370,11 +357,12 @@
"Blog",
13
]
- ]
+ ],
+ "name" : "020",
+ "id" : "020"
},
{
"name" : "021",
- "id" : "021",
"data" : [
[
"Perl",
@@ -388,11 +376,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "021"
},
{
"name" : "022",
- "id" : "022",
"data" : [
[
"Perl",
@@ -406,9 +394,11 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "022"
},
{
+ "id" : "023",
"data" : [
[
"Perl",
@@ -423,10 +413,10 @@
12
]
],
- "id" : "023",
"name" : "023"
},
{
+ "name" : "024",
"data" : [
[
"Perl",
@@ -441,12 +431,11 @@
11
]
],
- "id" : "024",
- "name" : "024"
+ "id" : "024"
},
{
- "name" : "025",
"id" : "025",
+ "name" : "025",
"data" : [
[
"Perl",
@@ -463,6 +452,7 @@
]
},
{
+ "name" : "026",
"data" : [
[
"Perl",
@@ -477,8 +467,7 @@
10
]
],
- "id" : "026",
- "name" : "026"
+ "id" : "026"
},
{
"id" : "027",
@@ -499,8 +488,6 @@
]
},
{
- "name" : "028",
- "id" : "028",
"data" : [
[
"Perl",
@@ -514,11 +501,11 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "028",
+ "id" : "028"
},
{
- "name" : "029",
- "id" : "029",
"data" : [
[
"Perl",
@@ -532,9 +519,12 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "029",
+ "id" : "029"
},
{
+ "id" : "030",
"data" : [
[
"Perl",
@@ -549,10 +539,11 @@
10
]
],
- "name" : "030",
- "id" : "030"
+ "name" : "030"
},
{
+ "id" : "031",
+ "name" : "031",
"data" : [
[
"Perl",
@@ -566,13 +557,10 @@
"Blog",
9
]
- ],
- "name" : "031",
- "id" : "031"
+ ]
},
{
"id" : "032",
- "name" : "032",
"data" : [
[
"Perl",
@@ -586,9 +574,12 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "032"
},
{
+ "id" : "033",
+ "name" : "033",
"data" : [
[
"Perl",
@@ -602,11 +593,10 @@
"Blog",
10
]
- ],
- "id" : "033",
- "name" : "033"
+ ]
},
{
+ "id" : "034",
"data" : [
[
"Perl",
@@ -621,12 +611,10 @@
11
]
],
- "name" : "034",
- "id" : "03