diff options
25 files changed, 2523 insertions, 2089 deletions
diff --git a/challenge-219/eric-cheung/python/ch-1.py b/challenge-219/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..13c7e71089 --- /dev/null +++ b/challenge-219/eric-cheung/python/ch-1.py @@ -0,0 +1,7 @@ +
+## arrInputList = [-2, -1, 0, 3, 4] ## Example 1
+arrInputList = [5, -4, -1, 3, 6] ## Example 2
+
+arrOutputList = sorted([nElem * nElem for nElem in arrInputList])
+
+print (arrOutputList)
diff --git a/challenge-219/eric-cheung/python/ch-2.py b/challenge-219/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..e4c1d29724 --- /dev/null +++ b/challenge-219/eric-cheung/python/ch-2.py @@ -0,0 +1,60 @@ +
+## Example 1
+## arrCost = [2, 7, 25]
+## arrDays = [1, 5, 6, 7, 9, 15]
+
+## Example 2
+arrCost = [2, 7, 25]
+arrDays = [1, 2, 3, 5, 7, 10, 11, 12, 14, 20, 30, 31]
+
+## Trial 1
+nCost = arrCost[2]
+
+## Trial 2
+nCost = min(nCost, arrCost[0] * len(arrDays))
+
+## Trial 3
+nLoop = 0
+nWeekCount = 0
+while nLoop < len(arrDays):
+ nLoopDay = arrDays[nLoop] + 6
+
+ ## print ("nLoop: " + str(nLoop))
+ ## print ("nLoopDay: " + str(nLoopDay))
+
+ arrSubDay = [nIndx for nIndx, nElem in enumerate(arrDays) if nElem >= nLoopDay]
+
+ if arrSubDay == []:
+ nWeekCount = nWeekCount + 1
+ break
+
+ nFindIndx = min(arrSubDay)
+ nShiftIndx = (1 if arrDays[nFindIndx] == nLoopDay else 0)
+ nLoop = nShiftIndx + nFindIndx
+ nWeekCount = nWeekCount + 1
+
+ ## print ("nWeekCount: " + str(nWeekCount))
+ ## print ("")
+
+
+## print (nWeekCount)
+nCost = min(nCost, arrCost[1] * nWeekCount)
+
+## Trial 4
+nLoop = 1
+nIndx = 0
+while nLoop < nWeekCount:
+ nLoopDay = arrDays[nIndx] + 6
+ arrSubDay = [nIndx for nIndx, nElem in enumerate(arrDays) if nElem >= nLoopDay]
+
+ if arrSubDay == []:
+ break
+
+ nFindIndx = min(arrSubDay)
+ nShiftIndx = (1 if arrDays[nFindIndx] == nLoopDay else 0)
+ nIndx = nShiftIndx + nFindIndx
+ nRemain = len(arrSubDay) - nShiftIndx
+ nCost = min(nCost, arrCost[1] * nLoop + arrCost[0] * nRemain)
+ nLoop = nLoop + 1
+
+print (nCost)
diff --git a/challenge-219/jeanluc2020/blog-1.txt b/challenge-219/jeanluc2020/blog.txt index 49272dae95..49272dae95 100644 --- a/challenge-219/jeanluc2020/blog-1.txt +++ b/challenge-219/jeanluc2020/blog.txt diff --git a/challenge-219/jeanluc2020/blog-2.txt b/challenge-219/jeanluc2020/blog1.txt index c047a2bc98..c047a2bc98 100644 --- a/challenge-219/jeanluc2020/blog-2.txt +++ b/challenge-219/jeanluc2020/blog1.txt diff --git a/challenge-219/robert-dicicco/julia/ch-1.jl b/challenge-219/robert-dicicco/julia/ch-1.jl new file mode 100644 index 0000000000..fb98a5a260 --- /dev/null +++ b/challenge-219/robert-dicicco/julia/ch-1.jl @@ -0,0 +1,35 @@ +#!/usr/bin/env julia +using Printf +#= +-------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-29 +Challenge 219 Sorted Squares Task 1 ( Julia ) +-------------------------------------- +=# + +list = [[-2, -1, 0, 3, 4], + [5, -4, -1, 3, 6] + ]; + +for lst in list + @printf("Input: @list = %s\n",lst) + lst = map((x) -> x ^ 2, lst) + @printf("%s\n\n",sort(lst)) +end + +#= +-------------------------------------- +SAMPLE OUTPUT +julia .\SortedSquares.jl + +Input: @list = [-2, -1, 0, 3, 4] +[0, 1, 4, 9, 16] + +Input: @list = [5, -4, -1, 3, 6] +[1, 9, 16, 25, 36] + +-------------------------------------- +=# + + diff --git a/challenge-219/robert-dicicco/perl/ch-1.pl b/challenge-219/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..0a0ef3c52a --- /dev/null +++ b/challenge-219/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,38 @@ +#!usr/bin/env perl +use strict; +use warnings; +use feature 'say'; +=begin comment +-------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-29 +Challenge 219 Sorted Squares Task 1 ( Perl ) +-------------------------------------- +=cut + +my @list = ([-2, -1, 0, 3, 4], + [5, -4, -1, 3, 6] + ); +my $cnt = (scalar @list) ; + +while ($cnt--) { + say "Input: \@list = [@{$list[$cnt]}]"; + my @squared_array = map { $_ ** 2 } @{$list[$cnt]}; + my @sorted = sort { $a <=> $b } @squared_array; + print "Output: ",join(", ", @sorted), "\n\n"; +} + +=begin comment +-------------------------------------- +SAMPLE OUTPUT + +perl .\SortedSquares.pl +Input: @list = [5 -4 -1 3 6] +Output: 1, 9, 16, 25, 36 + +Input: @list = [-2 -1 0 3 4] +Output: 0, 1, 4, 9, 16 +-------------------------------------- +=cut + + diff --git a/challenge-219/robert-dicicco/python/ch-1.py b/challenge-219/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..8823416047 --- /dev/null +++ b/challenge-219/robert-dicicco/python/ch-1.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +#-------------------------------------- +# AUTHOR: Robert DiCicco +# DATE : 2023-05-29 +# Challenge 219 Sorted Squares Task 1 ( Python ) +#-------------------------------------- + +mylist = [[-2, -1, 0, 3, 4], + [5, -4, -1, 3, 6] + ]; + +for lst in mylist: + print("Input: @list = ",lst) + print(sorted(list(map(lambda x: x * x, lst))),"\n") + +#-------------------------------------- +# SORTED OUTPUT +# python .\SortedSquares.py + +# Input: @list = [-2, -1, 0, 3, 4] +# [0, 1, 4, 9, 16] + +# Input: @list = [5, -4, -1, 3, 6] +# [1, 9, 16, 25, 36] + +#-------------------------------------- + + diff --git a/challenge-219/robert-dicicco/raku/ch-1.raku b/challenge-219/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..b844b85645 --- /dev/null +++ b/challenge-219/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,35 @@ +#!/usr/bin/env raku +=begin comment +-------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-29 +Challenge 219 Sorted Squares Task 1 ( Raku ) +-------------------------------------- +=end comment +use v6; + +my @list = ([-2, -1, 0, 3, 4], + [5, -4, -1, 3, 6] + ); +my $cnt = @list.elems ; + +for (@list) -> @lst { + say "Input: \@list = ",@lst; + my @squared_array = map(-> $x {$x ** 2},@lst).sort.join(','); + say "Output: ",@squared_array,"\n"; +} + +=begin comment +-------------------------------------- +SAMPLE OUTPUT +raku .\SortedSquares.rk + +Input: @list = [-2 -1 0 3 4] +Output: [0,1,4,9,16] + +Input: @list = [5 -4 -1 3 6] +Output: [1,9,16,25,36] +-------------------------------------- +=end comment + + diff --git a/challenge-219/robert-dicicco/ruby/ch-1.rb b/challenge-219/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..3c4fa8ceeb --- /dev/null +++ b/challenge-219/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +=begin +-------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-29 +Challenge 219 Sorted Squares Task 1 ( Ruby ) +-------------------------------------- +=end + +list = [[-2, -1, 0, 3, 4], + [5, -4, -1, 3, 6] + ]; + +list.each do |lst| + puts("Input: @list = #{lst}") + lst = lst.map { |val| val ** 2 } + puts("#{lst.sort}\n\n") +end + +=begin +-------------------------------------- +SAMPLE OUTPUT +ruby .\SortedSquares.rb + +Input: @list = [-2, -1, 0, 3, 4] +[0, 1, 4, 9, 16] + +Input: @list = [5, -4, -1, 3, 6] +[1, 9, 16, 25, 36] + +-------------------------------------- +=end + + diff --git a/stats/pwc-challenge-218.json b/stats/pwc-challenge-218.json new file mode 100644 index 0000000000..b07a6d1a61 --- /dev/null +++ b/stats/pwc-challenge-218.json @@ -0,0 +1,582 @@ +{ + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2023-05-30 09:44:44 GMT" + }, + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "data" : [ + { + "name" : "Arne Sommer", + "drilldown" : "Arne Sommer", + "y" : 3 + }, + { + "y" : 2, + "drilldown" : "Athanasius", + "name" : "Athanasius" + }, + { + "drilldown" : "Avery Adams", + "name" : "Avery Adams", + "y" : 3 + }, + { + "y" : 2, + "name" : "BarrOff", + "drilldown" : "BarrOff" + }, + { + "drilldown" : "Bruce Gray", + "name" : "Bruce Gray", + "y" : 2 + }, + { + "name" : "Cheok-Yin Fung", + "drilldown" : "Cheok-Yin Fung", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "David Ferrone", + "name" : "David Ferrone" + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "drilldown" : "Flavio Poletti", + "name" : "Flavio Poletti", + "y" : 6 + }, + { + "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas", + "y" : 5 + }, + { + "y" : 1, + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "y" : 2, + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey" + }, + { + "y" : 4, + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" + }, + { + "y" : 2, + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "y" : 3, + "drilldown" : "Matthias Muth", + "name" : "Matthias Muth" + }, + { + "y" : 2, + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke" + }, + { + "drilldown" : "Paulo Custodio", + "name" : "Paulo Custodio", + "y" : 2 + }, + { + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", + "y" : 3 + }, + { + "y" : 2, + "drilldown" : "Robbie Hatley", + "name" : "Robbie Hatley" + }, + { + "name" : "Robert DiCicco", + "drilldown" : "Robert DiCicco", + "y" : 4 + }, + { + "y" : 2, + "name" : "Robert Ransbottom", + "drilldown" : "Robert Ransbottom" + }, + { + "y" : 5, + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "name" : "Simon Green", + "drilldown" : "Simon Green", + "y" : 3 + }, + { + "y" : 1, + "name" : "Solathian", + "drilldown" : "Solathian" + }, + { + "y" : 3, + "drilldown" : "Stephen G. Lynn", + "name" : "Stephen G. Lynn" + }, + { + "y" : 1, + "name" : "Steven Wilson", + "drilldown" : "Steven Wilson" + }, + { + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler", + "y" : 4 + }, + { + "y" : 3, + "drilldown" : "Ulrich Rieke", + "name" : "Ulrich Rieke" + }, + { + "y" : 3, + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 218", + "colorByPoint" : 1 + } + ], + "chart" : { + "type" : "column" + }, + "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/>" + }, + "xAxis" : { + "type" : "category" + }, + "title" : { + "text" : "The Weekly Challenge - 218" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } + }, + "drilldown" : { + "series" : [ + { + "name" : "Arne Sommer", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Arne Sommer" + }, + { + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "name" : "Athanasius", + "id" : "Athanasius" + }, + { + "id" : "Avery Adams", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Avery Adams" + }, + { + "name" : "BarrOff", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "id" : "BarrOff" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Bruce Gray", + "name" : "Bruce Gray" + }, + { + "id" : "Cheok-Yin Fung", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Cheok-Yin Fung" + }, + { + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "David Ferrone" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "E. Choroba", + "id" : "E. Choroba" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Flavio Poletti", + "id" : "Flavio Poletti" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Jaldhar H. Vyas", + "id" : "Jaldhar H. Vyas" + }, + { + "data" : [ + [ + "Raku", + 1 + ] + ], + "id" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Jorg Sommrey" + }, + { + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" + }, + { + "name" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Lubos Kolouch" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Matthias Muth", + "id" : "Matthias Muth" + }, + { + "name" : "Niels van Dijke", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Niels van Dijke" + }, + { + "name" : "Paulo Custodio", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Paulo Custodio" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" + }, + { + "data" : [ + [ + "Perl", + 1 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Robbie Hatley", + "name" : "Robbie Hatley" + }, + { + "name" : "Robert DiCicco", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Robert DiCicco" + }, + { + "name" : "Robert Ransbottom", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Robert Ransbottom" + }, + { + "name" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Roger Bell_West" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Simon Green", + "name" : "Simon Green" + }, + { + "id" : "Solathian", + "data" : [ + [ + "Perl", + 1 + ] + ], + "name" : "Solathian" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Stephen G. Lynn", + "id" : "Stephen G. Lynn" + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "id" : "Steven Wilson", + "name" : "Steven Wilson" + }, + { + "name" : "Thomas Kohler", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Thomas Kohler" + }, + { + "id" : "Ulrich Rieke", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 1 + ] + ], + "name" : "Ulrich Rieke" + }, + { + "id" : "W. Luis Mochan", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "W. Luis Mochan" + } + ] + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index bfa4903fb6..9e922d8cb6 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,319 +1,95 @@ { + "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" + }, "series" : [ { - "name" : "The Weekly Challenge - 218", + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 219", "data" : [ { - "y" : 3, - "drilldown" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { "y" : 2, - "drilldown" : "Athanasius", - "name" : "Athanasius" - }, - { - "drilldown" : "Avery Adams", - "y" : 3, - "name" : "Avery Adams" - }, - { - "name" : "BarrOff", - "drilldown" : "BarrOff", - "y" : 2 - }, - { - "drilldown" : "Bruce Gray", - "y" : 2, - "name" : "Bruce Gray" - }, - { - "name" : "Cheok-Yin Fung", - "drilldown" : "Cheok-Yin Fung", - "y" : 2 - }, - { "drilldown" : "David Ferrone", - "y" : 2, "name" : "David Ferrone" }, { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "name" : "Flavio Poletti", - "drilldown" : "Flavio Poletti", - "y" : 6 - }, - { - "name" : "Jaldhar H. Vyas", - "drilldown" : "Jaldhar H. Vyas", - "y" : 5 - }, - { - "drilldown" : "Jan Krnavek", - "y" : 1, - "name" : "Jan Krnavek" + "y" : 8, + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari" }, { "y" : 2, - "drilldown" : "Jorg Sommrey", - "name" : "Jorg Sommrey" + "name" : "Robert DiCicco", + "drilldown" : "Robert DiCicco" }, { "y" : 4, - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" - }, - { - "name" : "Lubos Kolouch", - "y" : 2, - "drilldown" : "Lubos Kolouch" - }, - { - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Matthias Muth", - "y" : 3, - "name" : "Matthias Muth" - }, - { - "name" : "Niels van Dijke", - "y" : 2, - "drilldown" : "Niels van Dijke" - }, - { - "name" : "Paulo Custodio", - "drilldown" : "Paulo Custodio", - "y" : 2 - }, - { - "drilldown" : "Peter Campbell Smith", - "y" : 3, - "name" : "Peter Campbell Smith" - }, - { - "y" : 2, - "drilldown" : "Robbie Hatley", - "name" : "Robbie Hatley" - }, - { - "y" : 4, - "drilldown" : "Robert DiCicco", - "name" : "Robert DiCicco" - }, - { - "y" : 2, - "drilldown" : "Robert Ransbottom", - "name" : "Robert Ransbottom" - }, - { - "drilldown" : "Roger Bell_West", - "y" : 5, - "name" : "Roger Bell_West" - }, - { - "name" : "Simon Green", - "y" : 3, - "drilldown" : "Simon Green" + "name" : "Roger Bell_West", + "drilldown" : "Roger Bell_West" }, { "drilldown" : "Solathian", - "y" : 1 |
