diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-11-01 13:54:45 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-11-01 13:54:45 +0000 |
| commit | e8c4a1ac25bd587b09d3704264a6dc0619ae6dc5 (patch) | |
| tree | 45f8117f00ef6e47d2f02db4c526b8cfac2241e0 | |
| parent | 5e039eb08b5723bc317620e5fd1611c4db8555fb (diff) | |
| download | perlweeklychallenge-club-e8c4a1ac25bd587b09d3704264a6dc0619ae6dc5.tar.gz perlweeklychallenge-club-e8c4a1ac25bd587b09d3704264a6dc0619ae6dc5.tar.bz2 perlweeklychallenge-club-e8c4a1ac25bd587b09d3704264a6dc0619ae6dc5.zip | |
- Added solutions by Robert DiCicco.
| -rw-r--r-- | challenge-189/robert-dicicco/julia/ch-1.jl | 115 | ||||
| -rw-r--r-- | challenge-189/robert-dicicco/perl/ch-1.pl | 123 | ||||
| -rw-r--r-- | challenge-189/robert-dicicco/raku/ch-1.raku | 113 | ||||
| -rw-r--r-- | challenge-189/robert-dicicco/ruby/ch-1.rb | 105 | ||||
| -rw-r--r-- | challenge-189/robert-dicicco/tcl/ch-1.tcl | 127 | ||||
| -rw-r--r-- | stats/pwc-current.json | 157 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 60 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 2618 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 732 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 98 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 44 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 26 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 96 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 120 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 600 |
20 files changed, 3074 insertions, 2472 deletions
diff --git a/challenge-189/robert-dicicco/julia/ch-1.jl b/challenge-189/robert-dicicco/julia/ch-1.jl new file mode 100644 index 0000000000..59b3b9743c --- /dev/null +++ b/challenge-189/robert-dicicco/julia/ch-1.jl @@ -0,0 +1,115 @@ +#!/usr/bin/env julia + +#= + +AUTHOR: Robert DiCicco + +DATE: 2022-10-31 + +Challenge 189 Greater Character ( Julia ) + + + +You are given an array of characters (a..z) and a target character. + +Write a script to find out the smallest character in the given array + +lexicographically greater than the target character. + +=# + + + +using Printf + + + +arr = [["e", "m", "u", "g"], ["d", "c", "e", "f"], ["j","a","r"], ["d", "c", "a", "f"], ["t", "g", "a", "l"]] + +target = ["b", "a", "o", "a", "v" ] + + + +function TestValues( a, tv ) + + @printf("Input: @array = %s, target = %s\n", a,tv) + + out = [] + + for x in 1:length(a) + + if a[x] > tv + + push!(out, a[x]) + + end + + end + + out = sort!(out) + + length(out) == 0 ? println(tv) : println(out[1]) + + println(" ") + +end + + + +function main() + + cnt = 1 # arrays in julia are option base 1 + + for a in arr + + TestValues(a, target[cnt]) + + cnt += 1 + + end + +end + + + +main() + + + +#= + +------------------------------------------ + +SAMPLE OUTPUT + +PS G:\Projects\Perl\Challenges> julia .\GreaterChar.jl + +Input: @array = ["e", "m", "u", "g"], target = b + +e + + + +Input: @array = ["d", "c", "e", "f"], target = a + +c + + + +Input: @array = ["j", "a", "r"], target = o + +r + + + +Input: @array = ["d", "c", "a", "f"], target = a + +c + + + +Input: @array = ["t", "g", "a", "l"], target = v + +v + +=# diff --git a/challenge-189/robert-dicicco/perl/ch-1.pl b/challenge-189/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..1b6257e353 --- /dev/null +++ b/challenge-189/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,123 @@ +#!/usr/bin/env perl + +=pod + +AUTHOR: Robert DiCicco + +DATE: 2022-10-31 + +Challenge 189 Greater Character ( Perl ) + + + +You are given an array of characters (a..z) and a target character. + +Write a script to find out the smallest character in the given array + +lexicographically greater than the target character. + + + +=cut + + + +use strict; + +use warnings; + +use List::MoreUtils qw/minmax/; + +use signatures; + + + +my @arr = (["e", "m", "u", "g"], ["d", "c", "e", "f"], ["j","a","r"], ["d", "c", "a", "f"], ["t", "g", "a", "l"]) ; + +my @target = qw[b a o a v ]; + + + +sub TestValues( $a, $tv ) { + + my $x; + + my $sz = scalar @$a; + + print "Input: \@array = qw\(@$a\), target = $tv\n"; + + my @out = (); + + for ($x = 0; $x < $sz; $x++){ + + if (@$a[$x] gt $tv) { + + push(@out, @$a[$x]); + + } + + } + + @out = sort(@out); + + scalar @out > 0 ? print $out[0] . "\n\n" : print $tv . "\n\n"; + +} + + + +sub main { + + my $cnt = 0; + + foreach my $p (@arr) { + + TestValues($p,$target[$cnt++]); + + } + +} + + + +main(); + + + +=pod + +---------------------------------------------------- + +SAMPLE OUTPUT + +PS G:\Projects\Perl\Challenges> perl .\GreaterChar.pl + +Input: @array = qw(e m u g), target = b + +e + + + +Input: @array = qw(d c e f), target = a + +c + + + +Input: @array = qw(j a r), target = o + +r + + + +Input: @array = qw(d c a f), target = a + +c + + + +Input: @array = qw(t g a l), target = v + +v + +=cut diff --git a/challenge-189/robert-dicicco/raku/ch-1.raku b/challenge-189/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..687eb630a3 --- /dev/null +++ b/challenge-189/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,113 @@ +use v6; + +=begin comment + +AUTHOR: Robert DiCicco + +DATE: 2022-10-31 + +Challenge 189 Greater Character ( Raku ) + + + +You are given an array of characters (a..z) and a target character. + +Write a script to find out the smallest character in the given array + +lexicographically greater than the target character. + + + +=end comment + + + +my @arr = (["e", "m", "u", "g"], ["d", "c", "e", "f"], ["j","a","r"], ["d", "c", "a", "f"], ["t", "g", "a", "l"]) ; + +my @target = qw[b a o a v ]; + + + +sub TestValues( $a, $tv ) { + + my $x; + + print "Input: \@array = qw\(@$a\), target = $tv\n"; + + my @out = (); + + loop ($x = 0; $x < @$a.elems; $x++) { + + if (@$a[$x] gt $tv) { + + push(@out, @$a[$x]); + + } + + } + + @out.elems > 0 ?? say @out.sort[0] !! say $tv; + + say " "; + +} + + + +sub main { + + my $cnt = 0; + + for (@arr) -> $p { + + TestValues($p,@target[$cnt++]); + + } + +} + + + +main(); + + + +=begin comment + +------------------------------------------------------- + +SAMPLE OUTPUT + +PS G:\Projects\Perl\Challenges> raku .\GreaterChar.rk + +Input: @array = qw(@e m u g), target = b + +e + + + +Input: @array = qw(@d c e f), target = a + +c + + + +Input: @array = qw(@j a r), target = o + +r + + + +Input: @array = qw(@d c a f), target = a + +c + + + +Input: @array = qw(@t g a l), target = v + +v + + + +=end comment diff --git a/challenge-189/robert-dicicco/ruby/ch-1.rb b/challenge-189/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..c00e20fc55 --- /dev/null +++ b/challenge-189/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,105 @@ +#!/usr/bin/env ruby + +=begin + +AUTHOR: Robert DiCicco + +DATE: 2022-10-31 + +Challenge 189 Greater Character ( Ruby ) + + + +You are given an array of characters (a..z) and a target character. + +Write a script to find out the smallest character in the given array + +lexicographically greater than the target character. + +=end + + + +$arr = [["e", "m", "u", "g"], ["d", "c", "e", "f"], ["j","a","r"], ["d", "c", "a", "f"], ["t", "g", "a", "l"]] + +$target = %w{b a o a v } + + + +def TestValues (a, tv) + + print "Input: \@array = qw#{a}, target = #{tv}\n" + + out = [] + + for x in 0..a.length() do + + if (a[x].to_s > tv.to_s ) + + out.push(a[x].to_s) + + end + + end + + out.length() > 0 ? (puts "#{out.sort[0]}\n\n") : (puts "#{tv}\n\n") + +end + + + +def main() + + cnt = 0 + + $arr.each do |a| + + TestValues(a, $target[cnt]) + + cnt += 1 + + end + +end + + + +main() + + + +=begin + +---------------------------------------------- + +SAMPLE OUTPUT + +Input: @array = qw["e", "m", "u", "g"], target = b + +e + + + +Input: @array = qw["d", "c", "e", "f"], target = a + +c + + + +Input: @array = qw["j", "a", "r"], target = o + +r + + + +Input: @array = qw["d", "c", "a", "f"], target = a + +c + + + +Input: @array = qw["t", "g", "a", "l"], target = v + +v + +=end diff --git a/challenge-189/robert-dicicco/tcl/ch-1.tcl b/challenge-189/robert-dicicco/tcl/ch-1.tcl new file mode 100644 index 0000000000..baa02eab3b --- /dev/null +++ b/challenge-189/robert-dicicco/tcl/ch-1.tcl @@ -0,0 +1,127 @@ +#!/usr/bin/env tclsh + + + +set comment { + + AUTHOR: Robert DiCicco + + DATE: 2022-10-31 + + Challenge 189 Greater Character ( Tcl ) + + + + You are given an array of characters (a..z) and a target character. + + Write a script to find out the smallest character in the given array + + lexicographically greater than the target character. + +} + + + +proc TestValues { a tg } { + + puts "Input: @array = ($a), target = $tg" + + set out {} + + set x [llength $a] + + + + for {set i 0} {$i < $x} {incr i} { + + set v1 [lindex $a $i] + + if {[string compare $v1 $tg] == 1} { + + lappend out $v1 + + } + + } + + set x [llength $out] + + if {$x > 0} { + + set out [lsort $out] + + } else { + + lappend out $tg + + } + + puts "Output: [lindex $out 0]\n" + +} + + + +proc main {} { + + set arr {{e m u g} {d c e f} {j a r} {d c a f} {t g a l}} + + set target {b a o a v } + + set cnt 0 + + foreach a $arr { + + set tg [lindex $target $cnt] + + incr cnt + + TestValues $a $tg + + } + +} + + + +main + + + +set comment { + + ------------------------------------------------------- + + SAMPLE OUTPUT + + PS G:\Projects\Perl\Challenges> tclsh .\GreateChar.tcl + + Input: @array = (e m u g), target = b + + Output: e + + + + Input: @array = (d c e f), target = a + + Output: c + + + + Input: @array = (j a r), target = o + + Output: r + + + + Input: @array = (d c a f), target = a + + Output: c + + + + Input: @array = (t g a l), target = v + + Output: v + +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index fc423c6d76..32fa936b66 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,6 +1,10 @@ { + "title" : { + "text" : "The Weekly Challenge - 189" + }, "series" : [ { + "colorByPoint" : 1, "name" : "The Weekly Challenge - 189", "data" : [ { @@ -9,9 +13,9 @@ "name" : "Alexander Pankoff" }, { + "name" : "Andrew Grangaard", "y" : 2, - "drilldown" : "Andrew Grangaard", - "name" : "Andrew Grangaard" + "drilldown" : "Andrew Grangaard" }, { "y" : 2, @@ -19,23 +23,23 @@ "name" : "Humberto Massa" }, { - "name" : "James Smith", "drilldown" : "James Smith", - "y" : 3 + "y" : 3, + "name" : "James Smith" }, { + "y" : 4, "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari", - "y" : 4 + "name" : "Luca Ferrari" }, { "drilldown" : "Mark Anderson", - "name" : "Mark Anderson", - "y" : 2 + "y" : 2, + "name" : "Mark Anderson" }, { - "drilldown" : "Niels van Dijke", "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke", "y" : 2 }, { @@ -44,76 +48,100 @@ "y" : 3 }, { - "y" : 2, "name" : "Robbie Hatley", + "y" : 2, "drilldown" : "Robbie Hatley" }, { + "name" : "Robert DiCicco", + "drilldown" : "Robert DiCicco", + "y" : 2 + }, + { "y" : 4, "drilldown" : "Roger Bell_West", "name" : "Roger Bell_West" }, { - "drilldown" : "Tim Potapov", "name" : "Tim Potapov", - "y" : 2 + "y" : 2, + "drilldown" : "Tim Potapov" }, { + "drilldown" : "Ulrich Rieke", "y" : 4, - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke" + "name" : "Ulrich Rieke" }, { + "drilldown" : "W. Luis Mochan", "y" : 3, - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" + "name" : "W. Luis Mochan" } - ], - "colorByPoint" : 1 + ] } ], - "subtitle" : { - "text" : "[Champions: 13] Last updated at 2022-11-01 13:30:18 GMT" + "xAxis" : { + "type" : "category" }, - "title" : { - "text" : "The Weekly Challenge - 189" + "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/>" + }, + "subtitle" : { + "text" : "[Champions: 14] Last updated at 2022-11-01 13:53:03 GMT" }, "legend" : { "enabled" : 0 }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, "drilldown" : { "series" : [ { + "id" : "Alexander Pankoff", "name" : "Alexander Pankoff", "data" : [ [ "Perl", 2 ] - ], - "id" : "Alexander Pankoff" + ] }, { + "name" : "Andrew Grangaard", "data" : [ [ "Perl", 2 ] ], - "id" : "Andrew Grangaard", - "name" : "Andrew Grangaard" + "id" : "Andrew Grangaard" }, { - "name" : "Humberto Massa", "id" : "Humberto Massa", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Humberto Massa" }, { + "id" : "James Smith", "name" : "James Smith", "data" : [ [ @@ -124,10 +152,11 @@ "Blog", 1 ] - ], - "id" : "James Smith" + ] }, { + "id" : "Luca Ferrari", + "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -137,32 +166,31 @@ "Blog", 2 ] - ], - "id" : "Luca Ferrari", - "name" : "Luca Ferrari" + ] }, { "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "name" : "Mark Anderson" + ] }, { - "name" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] ], + "name" : "Niels van Dijke", "id" : "Niels van Dijke" }, { "id" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -172,21 +200,34 @@ "Blog", 1 ] - ], - "name" : "Peter Campbell Smith" + ] }, { - "name" : "Robbie Hatley", "data" : [ [ "Perl", 2 ] ], + "name" : "Robbie Hatley", "id" : "Robbie Hatley" }, { - "name" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "name" : "Robert DiCicco", + "id" : "Robert DiCicco" + }, + { + "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -197,20 +238,19 @@ 2 ] ], - "id" : "Roger Bell_West" + "name" : "Roger Bell_West" }, { - "name" : "Tim Potapov", "id" : "Tim Potapov", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Tim Potapov" }, { - "name" : "Ulrich Rieke", "id" : "Ulrich Rieke", "data" : [ [ @@ -221,7 +261,8 @@ "Raku", 2 ] - ] + ], + "name" : "Ulrich Rieke" }, { "data" : [ @@ -234,34 +275,12 @@ 1 ] ], - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan" + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan" } ] }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, "chart" : { "type" : "column" - }, - "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 - }, - "xAxis" : { - "type" : "category" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 3e88dccc1b..34b3a8d658 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,16 +1,33 @@ { - "legend" : { - "enabled" : "false" + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2022]" }, "subtitle" : { - "text" : "Last updated at 2022-11-01 13:30:18 GMT" + "text" : "Last updated at 2022-11-01 13:53:03 GMT" + }, + "legend" : { + "enabled" : "false" + }, + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" }, "series" : [ { - "name" : "Contributions", "data" : [ [ "Blog", @@ -18,46 +35,29 @@ ], [ "Perl", - 9220 + 9221 ], [ "Raku", - 5529 + 5530 ] ], "dataLabels" : { + "enabled" : "true", + "align" : "right", "y" : 10, "color" : "#FFFFFF", - "rotation" : -90, "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" }, - "enabled" : "true", "format" : "{point.y:.0f}", - "align" : "right" - } + "rotation" : -90 + }, + "name" : "Contributions" } ], - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 - }, - "chart" : { - "type" : "column" - }, "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 7edf489d69..49b56f239c 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,986 +1,4 @@ { - "chart" : { - "type" : "column" - }, - "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>" - }, - "xAxis" : { - "type" : "category" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, - "series" : [ - { - "colorByPoint" : "true", - "data" : [ - { - "name" : "#001", - "drilldown" : "001", - "y" : 161 - }, - { - "y" : 125, - "name" : "#002", - "drilldown" : "002" - }, - { - "name" : "#003", - "drilldown" : "003", - "y" : 83 - }, - { - "drilldown" : "004", - "name" : "#004", - "y" : 99 - }, - { - "name" : "#005", - "drilldown" : "005", - "y" : 78 - }, - { - "name" : "#006", - "drilldown" : "006", - "y" : 58 - }, - { - "name" : "#007", - "drilldown" : "007", - "y" : 65 - }, - { - "y" : 78, - "drilldown" : "008", - "name" : "#008" - }, - { - "y" : 76, - "drilldown" : "009", - "name" : "#009" - }, - { - "y" : 65, - "drilldown" : "010", - "name" : "#010" - }, - { - "y" : 85, - "name" : "#011", - "drilldown" : "011" - }, - { - "y" : 89, - "drilldown" : "012", - "name" : "#012" - }, - { - "name" : "#013", - "drilldown" : "013", - "y" : 85 - }, - { - "name" : "#014", - "drilldown" : "014", - "y" : 101 - }, - { - "y" : 99, - "name" : "#015", - "drilldown" : "015" - }, - { - "drilldown" : "016", - "name" : "#016", - "y" : 71 - }, - { - "y" : 84, - "name" : "#017", - "drilldown" : "017" - }, - { - "y" : 81, - "name" : "#018", - "drilldown" : "018" - }, - { - "y" : 103, - "drilldown" : "019", - "name" : "#019" - }, - { - "y" : 101, - "drilldown" : "020", - "name" : "#020" - }, - { - "y" : 72, - "drilldown" : "021", - "name" : "#021" - }, - { - "drilldown" : "022", - "name" : "#022", - "y" : 68< |
