diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-02 10:20:27 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-12-02 10:20:27 +0000 |
| commit | b27bbabd19f3774e6bb98dbfc41bc087c38f71a8 (patch) | |
| tree | 9cb8e446b5cdc0118ee9bdfc198b553fa70293df | |
| parent | e1ca071c2b1d06f472f0e74243b954a8fc142d54 (diff) | |
| download | perlweeklychallenge-club-b27bbabd19f3774e6bb98dbfc41bc087c38f71a8.tar.gz perlweeklychallenge-club-b27bbabd19f3774e6bb98dbfc41bc087c38f71a8.tar.bz2 perlweeklychallenge-club-b27bbabd19f3774e6bb98dbfc41bc087c38f71a8.zip | |
- Added solution by Robert DiCicco.
| -rw-r--r-- | challenge-193/robert-dicicco/python/ch-2.py | 85 | ||||
| -rw-r--r-- | challenge-193/robert-dicicco/raku/ch-2.raku | 103 | ||||
| -rw-r--r-- | challenge-193/robert-dicicco/ruby/ch-2.rb | 95 | ||||
| -rw-r--r-- | stats/pwc-current.json | 190 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 80 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 2722 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 722 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 88 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 120 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 30 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 96 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 44 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 88 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 42 |
18 files changed, 2503 insertions, 2220 deletions
diff --git a/challenge-193/robert-dicicco/python/ch-2.py b/challenge-193/robert-dicicco/python/ch-2.py new file mode 100644 index 0000000000..d0ce4b5e98 --- /dev/null +++ b/challenge-193/robert-dicicco/python/ch-2.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +# AUTHOR: Robert DiCicco + +# DATE: 2022-11-30 + +# Challenge 193 Odd String ( Python ) + + + +# You are given a list of strings of same length, @s. + + + +# Write a script to find the odd string in the given list. Use positional value of alphabet starting with 0, i.e. a = 0, b = 1, ... z = 25. + + + +# Find the difference array for each string as shown in the example. Then pick the odd one out. + +# ------------------------------------------------------------ + +# SAMPLE OUTPUT + +# python .\OddString.py + +# Input: @s = ['adc', 'wzy', 'abc'] + +# Output: abc + + + +# Input: @s = ['aaa', 'bob', 'ccc', 'ddd'] + +# Output: bob + + + +ss = [["adc", "wzy", "abc"],["aaa", "bob", "ccc", "ddd"]] + +mylist = [] + + + +def StringValue(s) : + + global mylist + + v1 = ord(s[1]) - ord(s[0]) + + v2 = ord(s[2]) - ord(s[1]) + + saved = f"{v1},{v2}" + + mylist.append(saved) + + + +def main() : + + for i in ss : + + print(f"Input: @s = {i}") + + global mylist + + for x in range(len(i)) : + + StringValue(i[x]) + + for x in range(len(i)) : + + cnt = mylist.count(mylist[x]) + + if cnt == 1 : + + print(f"Output: {i[x]}\n") + + mylist = [] + + + +if __name__ == '__main__': + + main() diff --git a/challenge-193/robert-dicicco/raku/ch-2.raku b/challenge-193/robert-dicicco/raku/ch-2.raku new file mode 100644 index 0000000000..1df02ab0e7 --- /dev/null +++ b/challenge-193/robert-dicicco/raku/ch-2.raku @@ -0,0 +1,103 @@ +#!/usr/bin/env raku + +=begin comment + +AUTHOR: Robert DiCicco + +DATE: 2022-11-30 + +Challenge 193 Odd String ( Raku ) + + + +You are given a list of strings of same length, @s. + + + +Write a script to find the odd string in the given list. Use positional value of alphabet starting with 0, i.e. a = 0, b = 1, ... z = 25. + + + +Find the difference array for each string as shown in the example. Then pick the odd one out. + +------------------------------------------------------------ + +SAMPLE OUTPUT + + + +raku .\OddString.rk + +Input: @n = [adc wzy abc] + +Output: abc + + + +Input: @n = [aaa bob ccc ddd] + +Output: bob + + + +=end comment + + + +use v6; + + + +my @ss = [["adc", "wzy", "abc"],["aaa", "bob", "ccc", "ddd"]]; + +my @out = []; + + + +sub StringValue($mystr) { + + my $val1 = substr($mystr,1,1); + + my $val0 = substr($mystr,0,1); + + my $val2 = substr($mystr,2,1); + + my $x = ord($val1) - ord($val0); + + my $y = ord($val2) - ord($val1); + + push(@out, "$x:$y"); + +} + + + +sub MAIN() { + + for @ss -> @n { + + put "Input: @n = \[" ~ @n ~ "]"; + + for 0..(@n.elems - 1) -> $x { + + StringValue(@n[$x]); + + } + + for 0..(@n.elems - 1) -> $x { + + my $cnt = @out.grep(@out[$x]).elems; + + if $cnt == 1 { + + print("Output: @n[$x]\n\n"); + + } + + } + + @out = []; + + } + +} diff --git a/challenge-193/robert-dicicco/ruby/ch-2.rb b/challenge-193/robert-dicicco/ruby/ch-2.rb new file mode 100644 index 0000000000..90bdb90f28 --- /dev/null +++ b/challenge-193/robert-dicicco/ruby/ch-2.rb @@ -0,0 +1,95 @@ +#!/usr/bin/env ruby + +=begin + +AUTHOR: Robert DiCicco + +DATE: 2022-11-30 + +Challenge 193 Odd String ( Ruby ) + + + +You are given a list of strings of same length, @s. + + + +Write a script to find the odd string in the given list. Use positional value of alphabet starting with 0, i.e. a = 0, b = 1, ... z = 25. + + + +Find the difference array for each string as shown in the example. Then pick the odd one out. + +------------------------------------------------------------ + +SAMPLE OUTPUT + +ruby .\OddString.rb + +Input: ["adc", "wzy", "abc"] + +Output: abc + + + +Input: ["aaa", "bob", "ccc", "ddd"] + +Output: bob + +=end + + + +ss = [["adc", "wzy", "abc"],["aaa", "bob", "ccc", "ddd"]] + + + +$myout = [] + + + +def StringValue(s) + + v1 = s[1].ord - s[0].ord + + v2 = s[2].ord - s[1].ord + + saved = "#{v1},#{v2}" + + $myout.push(saved) + +end + + + +ss.each do |i| + + ln = i.length() # i = ssubarray length + + puts("Input: #{i}") + + (0..ln-1).each do |x| + + StringValue(i[x]) # record value for each string + + end + + (0..i.length-1).each do |alen| + + c = $myout.count($myout[alen]) + + if c == 1 + + puts("Output: #{i[alen]}") + + break + + end + + end + + puts(" ") + + $myout = [] + +end diff --git a/stats/pwc-current.json b/stats/pwc-current.json index a2e26a5e1b..e67ba6a391 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,15 +1,6 @@ { - "xAxis" : { - "type" : "category" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } + "chart" : { + "type" : "column" }, "series" : [ { @@ -21,17 +12,17 @@ }, { "name" : "David Ferrone", - "drilldown" : "David Ferrone", - "y" : 2 + "y" : 2, + "drilldown" : "David Ferrone" }, { - "name" : "E. Choroba", + "y" : 2, "drilldown" : "E. Choroba", - "y" : 2 + "name" : "E. Choroba" }, { - "drilldown" : "Feng Chang", "y" : 2, + "drilldown" : "Feng Chang", "name" : "Feng Chang" }, { @@ -40,49 +31,49 @@ "name" : "Flavio Poletti" }, { - "name" : "James Smith", "y" : 3, - "drilldown" : "James Smith" + "drilldown" : "James Smith", + "name" : "James Smith" }, { - "drilldown" : "Laurent Rosenfeld", "y" : 5, + "drilldown" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld" }, { "name" : "Luca Ferrari", - "y" : 8, - "drilldown" : "Luca Ferrari" + "drilldown" : "Luca Ferrari", + "y" : 8 }, { - "drilldown" : "Mark Anderson", "y" : 2, + "drilldown" : "Mark Anderson", "name" : "Mark Anderson" }, { - "drilldown" : "Niels van Dijke", "y" : 2, + "drilldown" : "Niels van Dijke", "name" : "Niels van Dijke" }, { "name" : "Olivier Delouya", - "y" : 1, - "drilldown" : "Olivier Delouya" + "drilldown" : "Olivier Delouya", + "y" : 1 }, { - "y" : 3, + "name" : "Peter Campbell Smith", "drilldown" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith" + "y" : 3 }, { - "y" : 2, + "name" : "Robert DiCicco", "drilldown" : "Robert DiCicco", - "name" : "Robert DiCicco" + "y" : 3 }, { "name" : "Robert Ransbottom", - "y" : 2, - "drilldown" : "Robert Ransbottom" + "drilldown" : "Robert Ransbottom", + "y" : 2 }, { "name" : "Roger Bell_West", @@ -90,29 +81,29 @@ "y" : 4 }, { - "y" : 1, + "name" : "Simon Proctor", "drilldown" : "Simon Proctor", - "name" : "Simon Proctor" + "y" : 1 }, { - "name" : "Stephen G. Lynn", + "y" : 5, "drilldown" : "Stephen G. Lynn", - "y" : 5 + "name" : "Stephen G. Lynn" }, { - "name" : "Thomas Kohler", "drilldown" : "Thomas Kohler", - "y" : 2 + "y" : 2, + "name" : "Thomas Kohler" }, { - "drilldown" : "Ulrich Rieke", "y" : 4, + "drilldown" : "Ulrich Rieke", "name" : "Ulrich Rieke" }, { "name" : "Vamsi Meenavilli", - "y" : 2, - "drilldown" : "Vamsi Meenavilli" + "drilldown" : "Vamsi Meenavilli", + "y" : 2 }, { "drilldown" : "W. Luis Mochan", @@ -124,61 +115,55 @@ "colorByPoint" : 1 } ], - "chart" : { - "type" : "column" + "tooltip" : { + "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/>", + "followPointer" : 1 }, "title" : { "text" : "The Weekly Challenge - 193" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "subtitle" : { - "text" : "[Champions: 21] Last updated at 2022-12-02 09:39:17 GMT" - }, "drilldown" : { "series" : [ { - "name" : "Dario Mazzeo", - "id" : "Dario Mazzeo", "data" : [ [ "Perl", 1 ] - ] + ], + "id" : "Dario Mazzeo", + "name" : "Dario Mazzeo" }, { + "id" : "David Ferrone", + "name" : "David Ferrone", "data" : [ [ "Perl", 2 ] - ], - "id" : "David Ferrone", - "name" : "David Ferrone" + ] }, { - "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], + "id" : "E. Choroba", "name" : "E. Choroba" }, { "id" : "Feng Chang", + "name" : "Feng Chang", "data" : [ [ "Raku", 2 ] - ], - "name" : "Feng Chang" + ] }, { "data" : [ @@ -195,11 +180,12 @@ 2 ] ], - "id" : "Flavio Poletti", - "name" : "Flavio Poletti" + "name" : "Flavio Poletti", + "id" : "Flavio Poletti" }, { "id" : "James Smith", + "name" : "James Smith", "data" : [ [ "Perl", @@ -209,10 +195,11 @@ "Blog", 1 ] - ], - "name" : "James Smith" + ] }, { + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -226,9 +213,7 @@ "Blog", 1 ] - ], - "id" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" + ] }, { "name" : "Luca Ferrari", @@ -245,14 +230,14 @@ ] }, { + "name" : "Mark Anderson", "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "name" : "Mark Anderson" + ] }, { "name" : "Niels van Dijke", @@ -265,14 +250,14 @@ ] }, { - "name" : "Olivier Delouya", "data" : [ [ "Perl", 1 ] ], - "id" : "Olivier Delouya" + "id" : "Olivier Delouya", + "name" : "Olivier Delouya" }, { "data" : [ @@ -289,7 +274,6 @@ "name" : "Peter Campbell Smith" }, { - "name" : "Robert DiCicco", "data" : [ [ "Perl", @@ -297,23 +281,23 @@ ], [ "Raku", - 1 + 2 ] ], - "id" : "Robert DiCicco" + "id" : "Robert DiCicco", + "name" : "Robert DiCicco" }, { - "name" : "Robert Ransbottom", "data" : [ [ "Raku", 2 ] ], + "name" : "Robert Ransbottom", "id" : "Robert Ransbottom" }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -324,21 +308,20 @@ 2 ] ], - "name" : "Roger Bell_West" + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" }, { + "id" : "Simon Proctor", + "name" : "Simon Proctor", "data" : [ [ "Raku", 1 ] - ], - "id" : "Simon Proctor", - "name" : "Simon Proctor" + ] }, { - "name" : "Stephen G. Lynn", - "id" : "Stephen G. Lynn", "data" : [ [ "Perl", @@ -352,21 +335,21 @@ "Blog", 1 ] - ] + ], + "id" : "Stephen G. Lynn", + "name" : "Stephen G. Lynn" }, { - "id" : "Thomas Kohler", "data" : [ [ "Perl", 2 ] ], + "id" : "Thomas Kohler", "name" : "Thomas Kohler" }, { - "name" : "Ulrich Rieke", - "id" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -376,21 +359,23 @@ "Raku", 2 ] - ] + ], + "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke" }, { + "id" : "Vamsi Meenavilli", + "name" : "Vamsi Meenavilli", "data" : [ [ "Perl", 2 ] - ], - "id" : "Vamsi Meenavilli", - "name" : "Vamsi Meenavilli" + ] }, { - "name" : "W. Luis Mochan", "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -404,12 +389,27 @@ } ] }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "subtitle" : { + "text" : "[Champions: 21] Last updated at 2022-12-02 10:05:25 GMT" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, "legend" : { "enabled" : 0 - }, - "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/>" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 76f10af944..39c003cdd9 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,43 +1,15 @@ { - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "legend" : { - "enabled" : "false" - }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2022]" }, - "subtitle" : { - "text" : "Last updated at 2022-12-02 09:39:16 GMT" + "chart" : { + "type" : "column" }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" }, "series" : [ { - "dataLabels" : { - "format" : "{point.y:.0f}", - "align" : "right", - "rotation" : -90, - "y" : 10, - "color" : "#FFFFFF", - "enabled" : "true", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "name" : "Contributions", "data" : [ [ "Blog", @@ -49,15 +21,43 @@ ], [ "Raku", - 5685 + 5686 ] - ] + ], + "dataLabels" : { + "enabled" : "true", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "color" : "#FFFFFF", + "format" : "{point.y:.0f}", + "rotation" : -90, + "y" : 10, + "align" : "right" + }, + "name" : "Contributions" } ], - "chart" : { - "type" : "column" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2022]" + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" + }, + "subtitle" : { + "text" : "Last updated at 2022-12-02 10:05:25 GMT" + }, + "legend" : { + "enabled" : "false" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 0a3b3b3676..98172df2e1 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,6 +1,1002 @@ { + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2022-12-02 09:39:17 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2022-12-02 10:05:25 GMT" + }, + "legend" : { + "enabled" : "false" + }, + "title" : { + "text" : "The Weekly Challenge Language" + }, + "chart" : { + "type" : "column" + }, + "series" : [ + { + "name" : "The Weekly Challenge Languages", + "colorByPoint" : "true", + "data" : [ + { + "name" : "#001", + "drilldown" : "001", + "y" : 161 + }, + { + "name" : "#002", + "y" : 125, + "drilldown" : "002" + }, + { + "name" : "#003", + "y" : 83, + "drilldown" : "003" + }, + { + "drilldown" : "004", + "y" : 99, + "name" : "#004" + }, + { + "y" : 78, + "drilldown" : "005", + "name" : "#005" + }, + { + "drilldown" : "006", + "y" : 58, + "name" : "#006" + }, + { + "y" : 65, + "drilldown" : "007", + "name" : "#007" + }, + { + "y" : 78, + "drilldown" : "008", + "name" : "#008" + }, + { + "name" : "#009", + "y" : 76, + "drilldown" : "009" + }, + { + "name" : "#010", + "y" : 65, + "drilldown" : "010" + }, + { + "y" : 85, + "drilldown" : "011", + "name" : "#011" + }, + { + "name" : "#012", + "drilldown" : "012", + "y" : 89 + }, + { + "y" : 85, + "drilldown" : "013", + "name" : "#013" + }, + { + "name" : "#014", + "y" : 101, + "drilldown" : "014" + }, + { + "name" : "#015", + "y" : 99, + "drilldown" : "015" + }, + { + "y" : 71, + "drilldown" : "016", + "name" : "#016" + }, + { + "name" : "#017", + "drilldown" : "017", + "y" : 84 + }, + { + "name" : "#018", + "drilldown" : "018", + "y" : 81 + }, + { + "name" : "#019", + "y" : 103, + "drilldown" : "019" + }, + { + "drilldown" : "020", + "y" : 101, + "name" : "#020" + }, + { + "y" : 72, + "drilldown" : "021", + "name" : "#021" + }, + { + "y" : 68, + "drilldown" : "022", + "name" : "#022" + }, + { + "y" : 97, + "drilldown" : "023", + "name" : "#023" + }, + { + "name" : "#024", + "y" : 75, + "drilldown" : "024" + }, + { + "name" : "#025", + "y" : 59, + "drilldown" : "025" + }, + { + "drilldown" : "026", + "y" : 74, + "name" : "#026" + }, + { + "y" : 62, + "drilldown" : "027", + "name" : "#027" + }, + { + "name" : "#028", + "drilldown" : "028", + "y" : 82 + }, + { + "name" : "#029", + "drilldown" : "029", + "y" : 81 + }, + { + "name" : "#030", + "drilldown" : "030", + "y" : 119 + }, + { + "drilldown" : "031", + "y" : 91, + "name" : "#031" + }, + { + "drilldown" : "032", + "y" : 96, + "name" : "#032" + }, + { + "drilldown" : "033", + "y" : 112, + "name" : "#033" + }, + { + "name" : "#034", + "y" : 66, + "drilldown" : "034" + }, + { + "name" : "#035", + "y" : 66, + "drilldown" : "035" + }, + { + "drilldown" : "036", + "y" : 70, + "name" : "#036" + }, + { + "y" : 69, + "drilldown" : "037", + "name" : "#037" + }, + { + "name" : "#038", + "drilldown" : "038", + "y" : 70 + }, + { + "y" : 64, + "drilldown" : "039", + "name" : "#039" + }, + { + "y" : 75, + "drilldown" : "040", + "name" : "#040" + }, + { + "name" : "#041", + "y" : 78, + "drilldown" : "041" + }, + { + "y" : 94, + "drilldown" : "042", + "name" : "#042" + }, + { + "name" : "#043", + "y" : 70, + "drilldown" : "043" + }, + { + "drilldown" : "044", + "y" : 87, + "name" : "#044" + }, + { + "name" : "#045", + "y" : 98, + "drilldown" : "045" + }, + { + "y" : 89, + "drilldown" : "046", |
