diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-10-24 16:18:02 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-10-24 16:18:02 +0100 |
| commit | e5ab3b1367a35a8e8417ece83ea6420044b07f9b (patch) | |
| tree | 72f250068eee99d3e45d017a1bf4ce8e838bc1ce | |
| parent | a1348d709ea0973b8e3e7a7dfcf3ff439188626f (diff) | |
| download | perlweeklychallenge-club-e5ab3b1367a35a8e8417ece83ea6420044b07f9b.tar.gz perlweeklychallenge-club-e5ab3b1367a35a8e8417ece83ea6420044b07f9b.tar.bz2 perlweeklychallenge-club-e5ab3b1367a35a8e8417ece83ea6420044b07f9b.zip | |
- Added solutions by Thomas Kohler.
- Added solutions by Peter Campbell Smith.
- Added solutions by Luca Ferrari.
- Added solutions by Ali Moradi.
- Added solutions by Roger Bell_West.
- Added solutions by rcmlz.
- Added solutions by Robbie Hatley.
- Added solutions by Matthew Neleigh.
- Added solutions by Robert DiCicco.
23 files changed, 1975 insertions, 1587 deletions
diff --git a/challenge-240/rcmlz/raku/ch-1.raku b/challenge-240/rcmlz/raku/ch-1.raku new file mode 100644 index 0000000000..53b9658355 --- /dev/null +++ b/challenge-240/rcmlz/raku/ch-1.raku @@ -0,0 +1,13 @@ +unit module rcmlz::raku::task-one:ver<0.0.1>:auth<github:rcmlz>:api<1>; + +# run in terminal: raku --optimize=3 -I challenge-nr240/rcmlz/raku/ -- test/challenge-nr240/raku/task-one.rakutest +# or raku --optimize=3 -I challenge-nr240 -- test/benchmark-scalability.raku --task=task-one --user=rcmlz --max-run-times=1,3,7 --max-problem=10 --v=True --test-before-benchmark=True --out-folder=/tmp nr240; cat /tmp/nr240_task-one.csv + +#|[ +You are given an array of strings and a check string. + +- Write a script to find out if the check string is the acronym of the words in the given array. +] +our sub solution((Str $acr, List:D[Str:D] $str) --> Bool) is export { + $acr.lc eq $str.map( *.substr(0,1) ).join.lc; +}
\ No newline at end of file diff --git a/challenge-240/rcmlz/raku/ch-2.raku b/challenge-240/rcmlz/raku/ch-2.raku new file mode 100644 index 0000000000..03cf16692c --- /dev/null +++ b/challenge-240/rcmlz/raku/ch-2.raku @@ -0,0 +1,13 @@ +unit module rcmlz::raku::task-two:ver<0.0.1>:auth<github:rcmlz>:api<1>; + +# run in terminal: raku --optimize=3 -I challenge-nr240/rcmlz/raku/ -- test/challenge-nr240/raku/task-two.rakutest +# or raku --optimize=3 -I challenge-nr240 -- test/benchmark-scalability.raku --task=task-two --user=rcmlz --max-run-times=1,3,7 --max-problem=10 --v=True --test-before-benchmark=True --out-folder=/tmp nr240; cat /tmp/nr240_task-two.csv + +#|[ +You are given an array of integers. + +- Write a script to create an array such that new[i] = old[old[i]] where 0 <= i < new.length. +] +our sub solution(@input) is export { + @input[@input] +}
\ No newline at end of file diff --git a/challenge-240/robert-dicicco/julia/ch-2.jl b/challenge-240/robert-dicicco/julia/ch-2.jl new file mode 100644 index 0000000000..4dbd7c4529 --- /dev/null +++ b/challenge-240/robert-dicicco/julia/ch-2.jl @@ -0,0 +1,39 @@ +#!/usr/bin/env julia +#= +----------------------------------- +AUTHOR: Robert DiCicco +DATE : 23-OCT-2023 +Challenge 240 Task 02 Build Array ( Julia ) +----------------------------------- +=# + +using Printf + +myints = [[0, 2, 1, 5, 3, 4],[5, 0, 1, 2, 3, 4]] + +for mints in myints + out = [] + @printf("Input: @sints = %s\n",mints) + cnt = 1 + while cnt <= length(mints) + push!(out,mints[mints[cnt]+1]) + cnt += 1 + end + @printf("Output: %s\n\n", out) +end + +#= +----------------------------------- +SAMPLE OUTPUT + +julia .\BuildArray.jl + +Input: @sints = [0, 2, 1, 5, 3, 4] +Output: Any[0, 1, 2, 4, 5, 3] + +Input: @sints = [5, 0, 1, 2, 3, 4] +Output: Any[4, 5, 0, 1, 2, 3] +----------------------------------- +=# + + diff --git a/challenge-240/robert-dicicco/perl/ch-2.pl b/challenge-240/robert-dicicco/perl/ch-2.pl new file mode 100644 index 0000000000..7df1296189 --- /dev/null +++ b/challenge-240/robert-dicicco/perl/ch-2.pl @@ -0,0 +1,36 @@ +#!/usr/bin/env perl +=begin comment +----------------------------------- +AUTHOR: Robert DiCicco +DATE : 23-OCT-2023 +Challenge 240 Task 02 Build Array ( Perl ) +----------------------------------- +=cut +use v5.38; + +my @myints = ([0, 2, 1, 5, 3, 4],[5, 0, 1, 2, 3, 4]); + +for my $mints (@myints) { + my @out = (); + say "Input: \@ints = [@$mints]"; + for (my $cnt = 0; $cnt < scalar @$mints; $cnt++ ) { + push(@out, $mints->[$mints->[$cnt]]); + } + say "Output: [@out]\n"; +} + +=begin comment +----------------------------------- +SAMPLE OUTPUT + +perl .\BuildArray.pl + +Input: @ints = [0 2 1 5 3 4] +Output: [0 1 2 4 5 3] + +Input: @ints = [5 0 1 2 3 4] +Output: [4 5 0 1 2 3] +----------------------------------- +=cut + + diff --git a/challenge-240/robert-dicicco/powershell/ch-2.psl b/challenge-240/robert-dicicco/powershell/ch-2.psl new file mode 100644 index 0000000000..d57bc555fd --- /dev/null +++ b/challenge-240/robert-dicicco/powershell/ch-2.psl @@ -0,0 +1,34 @@ +#!/usr/bin/env powershell +<# +----------------------------------- +AUTHOR: Robert DiCicco +DATE : 23-OCT-2023 +Challenge 240 Task 02 Build Array ( Powershell ) + #> + +$myints = @(( 0, 2, 1, 5, 3, 4),(5, 0, 1, 2, 3, 4)) + +foreach ($mints in $myints ) { + $out = @() + write-host "Input: @ints = [$mints]" + $cnt = 0 + while ( $cnt -lt $mints.Count) { + $out += $mints[$mints[$cnt]] + $cnt += 1 + } + write-host "Output: [$out]`n" +} + +<# +----------------------------------- +SAMPLE OUTPUT +.\BuildArray.ps1 + +Input: @ints = [0 2 1 5 3 4] +Output: [0 1 2 4 5 3] + +Input: @ints = [5 0 1 2 3 4] +Output: [4 5 0 1 2 3] + #> + + diff --git a/challenge-240/robert-dicicco/python/ch-2.py b/challenge-240/robert-dicicco/python/ch-2.py new file mode 100644 index 0000000000..dce4c38546 --- /dev/null +++ b/challenge-240/robert-dicicco/python/ch-2.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +# ----------------------------------- +# AUTHOR: Robert DiCicco +# DATE : 23-OCT-2023 +# Challenge 240 Task 02 Build Array ( Python ) +# ----------------------------------- + +myints = [[0, 2, 1, 5, 3, 4],[5, 0, 1, 2, 3, 4]] + +for mints in myints: + out = [] + print(f"Input: @ints = {mints}") + cnt = 0 + while cnt < len(mints): + out.append(mints[mints[cnt]]) + cnt += 1 + print(f"Output: {out}\n") + +# ----------------------------------- +# SAMPLE OUTPUT +# python .\BuildArray.py + +# Input: @ints = [0, 2, 1, 5, 3, 4] +# Output: [0, 1, 2, 4, 5, 3] + +# Input: @ints = [5, 0, 1, 2, 3, 4] +# Output: [4, 5, 0, 1, 2, 3] +# ----------------------------------- + + + diff --git a/challenge-240/robert-dicicco/raku/ch-2.raku b/challenge-240/robert-dicicco/raku/ch-2.raku new file mode 100644 index 0000000000..ae20c32838 --- /dev/null +++ b/challenge-240/robert-dicicco/raku/ch-2.raku @@ -0,0 +1,36 @@ +#!/usr/bin/env raku +=begin comment +----------------------------------- +AUTHOR: Robert DiCicco +DATE : 23-OCT-2023 +Challenge 240 Task 02 Build Array ( Raku ) +----------------------------------- +=end comment +use v6; + +my @myints = ([0, 2, 1, 5, 3, 4],[5, 0, 1, 2, 3, 4]); + +for (@myints) -> @mints { + my @out = (); + say "Input: \@ints = ",[@mints]; + loop (my $cnt = 0; $cnt < @mints.elems; $cnt++ ) { + push(@out, @mints[@mints[$cnt]]); + } + say "Output: ",[@out],"\n"; +} + +=begin comment +----------------------------------- +SAMPLE OUTPUT + +raku .\BuildArray.rk + +Input: @ints = [0 2 1 5 3 4] +Output: [0 1 2 4 5 3] + +Input: @ints = [5 0 1 2 3 4] +Output: [4 5 0 1 2 3] +----------------------------------- +=end comment + + diff --git a/challenge-240/robert-dicicco/ruby/ch-2.rb b/challenge-240/robert-dicicco/ruby/ch-2.rb new file mode 100644 index 0000000000..80ae89e6a3 --- /dev/null +++ b/challenge-240/robert-dicicco/ruby/ch-2.rb @@ -0,0 +1,37 @@ +#!/usr/bin/env ruby +=begin +----------------------------------- +AUTHOR: Robert DiCicco +DATE : 23-OCT-2023 +Challenge 240 Task 02 Build Array ( Ruby ) +----------------------------------- +=end + +myints = [[0, 2, 1, 5, 3, 4],[5, 0, 1, 2, 3, 4]] + +myints.each do |mints| + out = [] + puts("Input: @ints = #{mints}") + cnt = 0 + while cnt < mints.length() + out.push(mints[mints[cnt]]) + cnt += 1 + end + puts("Output: #{out}\n\n"); +end + +=begin +----------------------------------- +SAMPLE OUTPUT + +ruby .\BuildArray.rb + +Input: @ints = [0, 2, 1, 5, 3, 4] +Output: [0, 1, 2, 4, 5, 3] + +Input: @ints = [5, 0, 1, 2, 3, 4] +Output: [4, 5, 0, 1, 2, 3] +----------------------------------- +=end + + diff --git a/stats/pwc-current.json b/stats/pwc-current.json index f172940a41..f19afb6974 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,15 +1,121 @@ { + "series" : [ + { + "name" : "The Weekly Challenge - 240", + "data" : [ + { + "name" : "Ali Moradi", + "drilldown" : "Ali Moradi", + "y" : 5 + }, + { + "drilldown" : "Dave Jacoby", + "y" : 2, + "name" : "Dave Jacoby" + }, + { + "name" : "David Ferrone", + "y" : 2, + "drilldown" : "David Ferrone" + }, + { + "name" : "E. Choroba", + "drilldown" : "E. Choroba", + "y" : 2 + }, + { + "drilldown" : "Lubos Kolouch", + "y" : 5, + "name" : "Lubos Kolouch" + }, + { + "drilldown" : "Luca Ferrari", + "y" : 10, + "name" : "Luca Ferrari" + }, + { + "name" : "Mark Anderson", + "y" : 4, + "drilldown" : "Mark Anderson" + }, + { + "name" : "Matthew Neleigh", + "y" : 2, + "drilldown" : "Matthew Neleigh" + }, + { + "drilldown" : "Niels van Dijke", + "y" : 2, + "name" : "Niels van Dijke" + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "y" : 2, + "drilldown" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "name" : "rcmlz", + "y" : 2, + "drilldown" : "rcmlz" + }, + { + "drilldown" : "Robbie Hatley", + "y" : 3, + "name" : "Robbie Hatley" + }, + { + "name" : "Robert DiCicco", + "y" : 4, + "drilldown" : "Robert DiCicco" + }, + { + "drilldown" : "Roger Bell_West", + "y" : 4, + "name" : "Roger Bell_West" + }, + { + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler", + "y" : 4 + }, + { + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke", + "y" : 4 + }, + { + "name" : "W. Luis Mochan", + "y" : 3, + "drilldown" : "W. Luis Mochan" + } + ], + "colorByPoint" : 1 + } + ], "drilldown" : { "series" : [ { - "name" : "Dave Jacoby", - "id" : "Dave Jacoby", "data" : [ [ "Perl", 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 ] - ] + ], + "id" : "Ali Moradi", + "name" : "Ali Moradi" }, { "data" : [ @@ -18,22 +124,30 @@ 2 ] ], + "id" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { "id" : "David Ferrone", - "name" : "David Ferrone" + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ] }, { + "id" : "E. Choroba", "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "id" : "E. Choroba" + ] }, { - "name" : "Lubos Kolouch", - "id" : "Lubos Kolouch", "data" : [ [ "Perl", @@ -47,11 +161,27 @@ "Blog", 1 ] - ] + ], + "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 8 + ] + ], + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" }, { - "name" : "Mark Anderson", "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Perl", @@ -64,42 +194,118 @@ ] }, { + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { "data" : [ [ "Perl", 2 ] ], - "id" : "Niels van Dijke", - "name" : "Niels van Dijke" + "name" : "Niels van Dijke", + "id" : "Niels van Dijke" + }, + { + "name" : "Peter Campbell Smith", + "id" : "Peter Campbell Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ] }, { - "name" : "Peter Meszaros", - "id" : "Peter Meszaros", "data" : [ [ "Perl", 2 ] + ], + "id" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "name" : "rcmlz", + "id" : "rcmlz", + "data" : [ + [ + "Raku", + 2 + ] ] }, { + "id" : "Robbie Hatley", + "name" : "Robbie Hatley", "data" : [ [ "Perl", + 2 + ], + [ + "Blog", 1 + ] + ] + }, + { + "name" : "Robert DiCicco", + "id" : "Robert DiCicco", + "data" : [ + [ + "Perl", + 2 ], [ "Raku", - 1 + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 ] ], - "id" : "Robert DiCicco", - "name" : "Robert DiCicco" + "id" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Thomas Kohler", + "id" : "Thomas Kohler" }, { - "name" : "Ulrich Rieke", "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -112,8 +318,6 @@ ] }, { - "name" : "W. Luis Mochan", - "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -123,87 +327,21 @@ "Blog", 1 ] - ] + ], + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan" } ] }, - "tooltip" : { - "followPointer" : 1, - "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/>" - }, - "chart" : { - "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "legend" : { + "enabled" : 0 }, "subtitle" : { - "text" : "[Champions: 10] Last updated at 2023-10-23 18:29:10 GMT" + "text" : "[Champions: 18] Last updated at 2023-10-24 15:11:21 GMT" }, - "legend" : { - "enabled" : 0 + "title" : { + "text" : "The Weekly Challenge - 240" }, - "series" : [ - { - "data" : [ - { - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby", - "y" : 2 - }, - { - "y" : 2, - "name" : "David Ferrone", - "drilldown" : "David Ferrone" - }, - { - "y" : 2, - "name" : "E. Choroba", - "drilldown" : "E. Choroba" - }, - { - "y" : 5, - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch" - }, - { - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson", - "y" : 4 - }, - { - "drilldown" : "Niels van Dijke", - "name" : "Niels van Dijke", - "y" : 2 - }, - { - "name" : "Peter Meszaros", - "drilldown" : "Peter Meszaros", - "y" : 2 - }, - { - "name" : "Robert DiCicco", - "drilldown" : "Robert DiCicco", - "y" : 2 - }, - { - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke", - "y" : 4 - }, - { - "y" : 3, - "drilldown" : "W. Luis Mochan", - "name" : "W. Luis Mochan" - } - ], - "name" : "The Weekly Challenge - 240", - "colorByPoint" : 1 - } - ], "plotOptions" : { "series" : { "borderWidth" : 0, @@ -213,8 +351,18 @@ } } }, - "title" : { - "text" : "The Weekly Challenge - 240" + "tooltip" : { + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", + "followPointer" : 1, + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "chart" : { + "type" : "column" }, "xAxis" : { "type" : "category" diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 45c224c676..b761bbdecc 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,4 +1,16 @@ { + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, "yAxis" : { "min" : 0, "title" : { @@ -8,56 +20,44 @@ "chart" : { "type" : "column" }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2023]" }, "legend" : { "enabled" : "false" }, "subtitle" : { - "text" : "Last updated at 2023-10-23 18:29:10 GMT" + "text" : "Last updated at 2023-10-24 15:11:21 GMT" }, "series" : [ { - "name" : "Contributions", - "dataLabels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - }, - "align" : "right", - "format" : "{point.y:.0f}", - "y" : 10, - "rotation" : -90, - "color" : "#FFFFFF", - "enabled" : "true" - }, "data" : [ [ "Blog", - 4096 + 4109 ], [ "Perl", - 12339 + 12352 ], [ "Raku", - 7110 + 7119 ] - ] - } - ], - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2023]" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + ], + "name" : "Contributions", + "dataLabels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "y" : 10, + "color" : "#FFFFFF", + "format" : "{point.y:.0f}", + "enabled" : "true", + "rotation" : -90, + "align" : "right" } - }, - "type" : "category" - } + } + ] } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 5dbae96f8b..72c559bc26 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,21 +1,13 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "chart" : { - "type" : "column" + "title" : { + "text" : "The Weekly Challenge Language" }, - "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>" + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2023-10-24 15:11:21 GMT" }, "drilldown" : { "series" : [ { - "name" : "001", "data" : [ [ "Perl", @@ -30,10 +22,12 @@ 12 ] ], - "id" : "001" + "id" : "001", + "name" : "001" }, { "name" : "002", + "id" : "002", "data" : [ [ "Perl", @@ -47,11 +41,9 @@ "Blog", 10 ] - ], - "id" : "002" + ] }, { - "name" : "003", "data" : [ [ "Perl", @@ -66,10 +58,10 @@ 9 ] ], + "name" : "003", "id" : "003" }, { - "name" : "004", "data" : [ [ "Perl", @@ -84,9 +76,11 @@ 10 ] ], - "id" : "004" + "id" : "004", + "name" : "004" }, { + "name" : "005", "id" : "005", "data" : [ [ @@ -101,11 +95,9 @@ "Blog", 12 ] - ], - "name" : "005" + ] }, { - "id" : "006", "data" : [ [ "Perl", @@ -120,10 +112,12 @@ 7 ] ], - "name" : "006" + "name" : "006", + "id" : "006" }, { "name" : "007", + "id" : "007", "data" : [ [ "Perl", @@ -137,12 +131,11 @@ "Blog", 10 ] - ], - "id" : "007" + ] }, { - "name" : "008", "id" : "008", + "name" : "008", "data" : [ [ "Perl", @@ -160,6 +153,7 @@ }, { "name" : "009", + "id" : "009", "data" : [ [ "Perl", @@ -173,8 +167,7 @@ "Blog", 13 ] - ], - "id" : "009" + ] }, { "data" : [ @@ -191,11 +184,10 @@ 11 ] ], - "id" : "010", - "name" : "010" + "name" : "010", + "id" : "010" }, { - "name" : "011", "data" : [ [ "Perl", @@ -210,10 +202,10 @@ 10 ] |
