diff options
23 files changed, 2661 insertions, 2383 deletions
diff --git a/challenge-215/eric-cheung/python/ch-1.py b/challenge-215/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..1398ab8a04 --- /dev/null +++ b/challenge-215/eric-cheung/python/ch-1.py @@ -0,0 +1,16 @@ +
+## arrWordInput = ['abc', 'xyz', 'tsu'] ## Example 1
+## arrWordInput = ['rat', 'cab', 'dad'] ## Example 2
+arrWordInput = ['x', 'y', 'z'] ## Example 3
+
+arrRemovedWord = []
+
+for strWordLoop in arrWordInput:
+
+ strSortWordLoop = ''.join(sorted(strWordLoop))
+ if strWordLoop == strSortWordLoop:
+ continue
+
+ arrRemovedWord.append(strWordLoop)
+
+print (len(arrRemovedWord))
diff --git a/challenge-215/eric-cheung/python/ch-2.py b/challenge-215/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..8c366a73f6 --- /dev/null +++ b/challenge-215/eric-cheung/python/ch-2.py @@ -0,0 +1,26 @@ +
+## Example 1
+## arrNum = [1, 0, 0, 0, 1]
+## nCount = 1
+
+## Example 2
+## arrNum = [1, 0, 0, 0, 1]
+## nCount = 2
+
+## Example 3
+arrNum = [1, 0, 0, 0, 0, 0, 0, 0, 1]
+nCount = 3
+
+for nIndxLoop in range(1, len(arrNum) - 1):
+
+ if nCount == 0:
+ break
+
+ if arrNum[nIndxLoop - 1] == 0 and arrNum[nIndxLoop] == 0 and arrNum[nIndxLoop + 1] == 0:
+ arrNum[nIndxLoop] = 1
+ nCount = nCount - 1
+
+if nCount == 0:
+ print (1)
+else:
+ print (0)
diff --git a/challenge-215/robert-dicicco/julia/ch-1.jl b/challenge-215/robert-dicicco/julia/ch-1.jl new file mode 100644 index 0000000000..74c9ca9849 --- /dev/null +++ b/challenge-215/robert-dicicco/julia/ch-1.jl @@ -0,0 +1,40 @@ +#!/usr/bin/env julia +#= +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Julia ) +---------------------------------------- +=# +using Printf + +words = [["abc","xyz","tsu"],["rat", "cab", "dad"],["x", "y", "z"]] + +for wds in words + cnt = 0 + @printf("Input: @words = %s\n",wds) + for w in wds + str1_arr = join(sort(collect(w))) + if (cmp(w,str1_arr) != 0) + cnt += 1 + end + end + @printf("Output: %d\n\n", cnt) +end + +#= +---------------------------------------- +SAMPLE OUTPUT +julia .\OddOneOut.jl +Input: @words = ["abc", "xyz", "tsu"] +Output: 1 + +Input: @words = ["rat", "cab", "dad"] +Output: 3 + +Input: @words = ["x", "y", "z"] +Output: 0 +---------------------------------------- +=# + + diff --git a/challenge-215/robert-dicicco/perl/ch-1.pl b/challenge-215/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..5e2b7f6ea8 --- /dev/null +++ b/challenge-215/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,41 @@ +#!/usr/bin/enc perl +=begin pod +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Perl ) +---------------------------------------- +=cut +use strict; +use warnings; +use feature 'say'; + +my @words = (["abc", "xyz", "tsu"],["rat", "cab", "dad"],["x", "y", "z"]); + +for my $wds (@words) { + my $cnt = 0; + say "Input: \@words = (@$wds)"; + for my $w (@$wds) { + my $w_sorted = join("",sort(split(//,$w))); + $cnt++ if ($w ne $w_sorted); + } + say "Output: $cnt\n"; +} + +=begin pod +---------------------------------------- +SAMPLE OUTPUT +perl .\OddOneOut.pl +Input: @words = (abc xyz tsu) +Output: 1 + +Input: @words = (rat cab dad) +Output: 3 + +Input: @words = (x y z) +Output: 0 +---------------------------------------- +=cut + + + diff --git a/challenge-215/robert-dicicco/python/ch-1.py b/challenge-215/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..158c58097c --- /dev/null +++ b/challenge-215/robert-dicicco/python/ch-1.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +''' +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Python ) +---------------------------------------- +''' + +words = [["abc","xyz","tsu"],["rat", "cab", "dad"],["x", "y", "z"]] + +for wds in words: + cnt = 0 + print("Input: @words = ",wds) + for w in wds: + w_sorted = ''.join(sorted(w, key=str.lower)) + if w != w_sorted: + cnt += 1 + print("Output: ",cnt,"\n") + +''' + ---------------------------------------- +SAMPLE OUTPUT +python .\OddOneOut.py +Input: @words = ['abc', 'xyz', 'tsu'] +Output: 1 +Input: @words = ['rat', 'cab', 'dad'] +Output: 3 +Input: @words = ['x', 'y', 'z'] +Output: 0 + ---------------------------------------- +''' + + diff --git a/challenge-215/robert-dicicco/raku/ch-1.raku b/challenge-215/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..c14bf8604c --- /dev/null +++ b/challenge-215/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,38 @@ +#!/usr/bin/env raku +#`{ +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Raku ) +---------------------------------------- +} +my @words = ('abc', 'xyz', 'tsu'),('rat', 'cab', 'dad'),('x', 'y', 'z'); + +for (@words) -> @wds { + my $cnt = 0; + say "Input: \@words = ", @wds; + for (@wds) -> $w { + if $w ne $w.comb.sort.join { + $cnt++; + } + } + say "Output: ", $cnt; + say " "; +} + +#`{ +---------------------------------------- +SAMPLE OUTPUT +raku .\OddOneOut.rk +Input: @words = (abc xyz tsu) +Output: 1 + +Input: @words = (rat cab dad) +Output: 3 + +Input: @words = (x y z) +Output: 0 +} + + + diff --git a/challenge-215/robert-dicicco/ruby/ch-1.rb b/challenge-215/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..acf5ca9845 --- /dev/null +++ b/challenge-215/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,40 @@ +#!/usr/bin/env ruby +=begin +---------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-05-01 +Challenge 215 Odd One Out ( Ruby ) +---------------------------------------- +=end + +words = [["abc","xyz","tsu"],["rat", "cab", "dad"],["x", "y", "z"]] + +words.each do |wds| + cnt = 0 + puts("Input: @words = #{wds}") + wds.each do |w| + srt = w.chars.sort.join + if w != srt + cnt += 1 + end + end + puts("Output: #{cnt}") + puts +end + +=begin +---------------------------------------- +SAMPLE OUTPUT +ruby .\OddOneOut.rb +Input: @words = ["abc", "xyz", "tsu"] +Output: 1 + +Input: @words = ["rat", "cab", "dad"] +Output: 3 + +Input: @words = ["x", "y", "z"] +Output: 0 +---------------------------------------- +=end + + diff --git a/challenge-215/ziameraj16/java/OddOneOut.java b/challenge-215/ziameraj16/java/OddOneOut.java new file mode 100644 index 0000000000..bbd53574b7 --- /dev/null +++ b/challenge-215/ziameraj16/java/OddOneOut.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class OddOneOut { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + List<String> values = Arrays.stream(scanner.nextLine().split(",")).toList(); + int count = 0; + List<String> newList = new ArrayList<>(values.size()); + for (String str : values) { + String temp = new String(str); + final char[] chars = str.toCharArray(); + Arrays.sort(chars); + if (!temp.equals(new String(chars))) { + count++; + } else { + newList.add(str); + } + } + System.out.println(count); + System.out.println(newList); + } +} + diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 60b33053b6..bb33139efa 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,25 +1,4 @@ { - "title" : { - "text" : "The Weekly Challenge - 215" - }, - "subtitle" : { - "text" : "[Champions: 11] Last updated at 2023-05-02 09:35:15 GMT" - }, - "legend" : { - "enabled" : 0 - }, - "xAxis" : { - "type" : "category" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, "yAxis" : { "title" : { "text" : "Total Solutions" @@ -28,11 +7,74 @@ "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/>" - }, + "series" : [ + { + "data" : [ + { + "name" : "Carlos Oliveira", + "drilldown" : "Carlos Oliveira", + "y" : 2 + }, + { + "name" : "David Ferrone", + "drilldown" : "David Ferrone", + "y" : 2 + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "drilldown" : "James Smith", + "y" : 3, + "name" : "James Smith" + }, + { + "y" : 2, + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "drilldown" : "Niels van Dijke", + "y" : 2, + "name" : "Niels van Dijke" + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "drilldown" : "Robert DiCicco", + "y" : 2, + "name" : "Robert DiCicco" + }, + { + "y" : 2, + "drilldown" : "Stephen G. Lynn", + "name" : "Stephen G. Lynn" + }, + { + "name" : "Thomas Kohler", + "y" : 4, + "drilldown" : "Thomas Kohler" + }, + { + "y" : 3, + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 215", + "colorByPoint" : 1 + } + ], "drilldown" : { "series" : [ { @@ -42,8 +84,8 @@ 2 ] ], - "id" : "Carlos Oliveira", - "name" : "Carlos Oliveira" + "name" : "Carlos Oliveira", + "id" : "Carlos Oliveira" }, { "data" : [ @@ -52,12 +94,12 @@ 2 ] ], - "id" : "David Ferrone", - "name" : "David Ferrone" + "name" : "David Ferrone", + "id" : "David Ferrone" }, { - "name" : "E. Choroba", "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Perl", @@ -80,18 +122,18 @@ ] }, { + "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ], - "name" : "Lubos Kolouch", - "id" : "Lubos Kolouch" + ] }, { - "name" : "Mark Anderson", "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Raku", @@ -100,8 +142,8 @@ ] }, { - "id" : "Niels van Dijke", "name" : "Niels van Dijke", + "id" : "Niels van Dijke", "data" : [ [ "Perl", @@ -110,8 +152,6 @@ ] }, { - "id" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -121,11 +161,27 @@ "Blog", 1 ] - ] + ], + "name" : "Peter Campbell Smith", + "id" : "Peter Campbell Smith" + }, + { + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "name" : "Robert DiCicco", + "id" : "Robert DiCicco" }, { - "id" : "Stephen G. Lynn", "name" : "Stephen G. Lynn", + "id" : "Stephen G. Lynn", "data" : [ [ "Perl", @@ -134,8 +190,6 @@ ] }, { - "name" : "Thomas Kohler", - "id" : "Thomas Kohler", "data" : [ [ "Perl", @@ -145,11 +199,11 @@ "Blog", 2 ] - ] + ], + "id" : "Thomas Kohler", + "name" : "Thomas Kohler" }, { - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -159,71 +213,36 @@ "Blog", 1 ] - ] + ], + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan" } ] }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 215", - "data" : [ - { - "drilldown" : "Carlos Oliveira", - "name" : "Carlos Oliveira", - "y" : 2 - }, - { - "drilldown" : "David Ferrone", - "name" : "David Ferrone", - "y" : 2 - }, - { - "name" : "E. Choroba", - "y" : 2, - "drilldown" : "E. Choroba" - }, - { - "drilldown" : "James Smith", - "y" : 3, - "name" : "James Smith" - }, - { - "name" : "Lubos Kolouch", - "y" : 2, - "drilldown" : "Lubos Kolouch" - }, - { - "y" : 2, - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson" - }, - { - "drilldown" : "Niels van Dijke", - "y" : 2, - "name" : "Niels van Dijke" - }, - { - "drilldown" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith", - "y" : 3 - }, - { - "drilldown" : "Stephen G. Lynn", - "name" : "Stephen G. Lynn", - "y" : 2 - }, - { - "drilldown" : "Thomas Kohler", - "name" : "Thomas Kohler", - "y" : 4 - }, - { - "drilldown" : "W. Luis Mochan", - "name" : "W. Luis Mochan", - "y" : 3 - } - ] + "legend" : { + "enabled" : 0 + }, + "title" : { + "text" : "The Weekly Challenge - 215" + }, + "subtitle" : { + "text" : "[Champions: 12] Last updated at 2023-05-02 16:06:01 GMT" + }, + "xAxis" : { + "type" : "category" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 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 3f525cdd58..d7352c8b1f 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,16 +1,43 @@ { - "legend" : { - "enabled" : "false" - }, "subtitle" : { - "text" : "Last updated at 2023-05-02 09:35:14 GMT" + "text" : "Last updated at 2023-05-02 16:06:01 GMT" }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2023]" + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } + }, + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 }, "series" : [ { "name" : "Contributions", + "dataLabels" : { + "rotation" : -90, + "y" : 10, + "format" : "{point.y:.0f}", + "align" : "right", + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "color" : "#FFFFFF", + "enabled" : "true" + }, "data" : [ [ "Blog", @@ -18,46 +45,19 @@ ], [ "Perl", - 10916 + 10917 ], [ "Raku", - 6324 + 6325 ] - ], - "dataLabels" : { - "enabled" : "true", - "format" : "{point.y:.0f}", - "y" : 10, - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "align" : "right", - "color" : "#FFFFFF", - "rotation" : -90 - } + ] } ], - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "chart" : { - "type" : "column" - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } + "legend" : { + "enabled" : "false" }, - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2023]" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index b3d5f6d61f..0c0a85437c 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,16 +1,1115 @@ { "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2023-05-02 09:35:15 GMT" + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2023-05-02 16:06:01 GMT" }, - "legend" : { - "enabled" : "false" + "xAxis" : { + "type" : "category" }, - "title" : { - "text" : "The Weekly Challenge Language" + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } + }, + "tooltip" : { + "headerFormat" : "<span style=\"font-size:11px\"></span>", + "followPointer" : "true", + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>" }, "chart" : { "type" : "column" }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "series" : [ + { + "data" : [ + { + "name" : "#001", + "drilldown" : "001", + "y" : 163 + }, + { + "y" : 129, + "drilldown" : "002", + "name" : "#002" + }, + { + "y" : 87, + "drilldown" : "003", + "name" : "#003" + }, + { + "drilldown" : "004", + "y" : 103, + "name" : "#004" + }, + { + "name" : "#005", + "drilldown" : "005", + "y" : 80 + }, + { + "y" : 61, + "drilldown" : "006", + "name" : "#006" + }, + { + "drilldown" : "007", + "y" : 69, + "name" : "#007" + }, + { + "y" : 82, + "drilldown" : "008", + "name" : "#008" + }, + { + "name" : "#009", + "drilldown" : "009", + "y" : 80 + }, + { + "name" : "#010", + "y" : 69, + "drilldown" : "010" + }, + { + "y" : 89, + "drilldown" : "011", + "name" : "#011" + }, + { + "drilldown" : "012", + "y" : 92, + "name" : "#012" + }, + { + "name" : "#013", + "drilldown" : "013", + "y" : 87 + }, + { + "y" : 102, + "drilldown" : "014", + "name" : "#014" + }, + { + "name" : "#015", + "drilldown" : "015", + "y" : 101 + }, + { + "name" : "#016", + "y" : 72, + "drilldown" : "016" + }, + { + "drilldown" : "017", + "y" : 86, + "name" : "#017" + }, + { + "name" : "#018", + "drilldown" : "018", + "y" : 83 + }, + { + "y" : 105, + "drilldown" : "019", + "name" : "#019" + }, + { + "drilldown" : "020", + "y" : 103, + "name" : "#020" + }, + { + "drilldown" : "021", + "y" : 74, + "name" : "#021" + }, + { + "y" : 72, + "drilldown" : "022", + "name" : "#022" + }, + { + "drilldown" : "023", + "y" : 101, + "name" : "#023" + }, + { + "name" : "#024", + "drilldown" : "024", + "y" : 77 + }, + { + "y" : 62, + "drilldown" : "025", + "name" : "#025" + }, + { + "name" : "#026", + "drilldown" : "026", + "y" : 76 + }, + { + "name" : "#027", + "drilldown" : "027", + "y" : 64 + }, + { + "drilldown" : "028", + "y" : 82, + "name" : "#028" + }, + { + "y" : 83, + "drilldown" : "029", + "name" : "#029" + }, + { + "name" : "#030", + "drilldown" : "030", + "y" : 121 + }, + { + "drilldown" : "031", + "y" : 93, + "name" : "#031" + }, + { + "name" : "#032", + "y" : 98, + "drilldown" : "032" + }, + { + "name" : "#033", + "drilldown" : "033", + "y" : 114 + }, + { + "y" : 70, + "drilldown" : "034", + "name" : "#034" + }, + { + "name" : "#035", + "drilldown" : "035", + "y" : 68 + }, + { + "name" : "#036", + "drilldown" : "036", + "y" : 70 + }, + { + "name" : "#037", + "drilldown" : "037", + "y" : 70 + }, + { + "drilldown" : "038", + "y" : 74, + "name" : "#038" + }, + { + "y" : 68, + "drilldown" : "039", + "name" : "#039" + }, + { + "y" : 77, + "drilldown" : "040", + "name" : "#040" + }, + { + "name" : "#041", + "drilldown" : "041", + "y" : 80 + }, + { + "name" : "#042", + "y" : 98, + "drilldown" : "042" + }, + { + "name" : "#043", + "y" : 72, + "drilldown" : "043" + }, + { + "y" : 90, + "drilldown" : "044", + "name" : "#044" + }, + { + "name" : "#045", + "drilldown" : "045", + "y" : 102 + }, + { + "drilldown" : "046", + "y" : 93, + "name" : "#046" + }, + { + "drilldown" : "047", + "y" : 88, + "name" : "#047" + }, + { + "drilldown" : "048", + "y" : 112, + "name" : "#048" + }, + { + "name" : "#049", + "y" : 93, + "drilldown" : "049" + }, + { + "drilldown" : "050", + "y" : 104, + "name" : "#050" + }, + { + "drilldown" : "051", + "y" : 95, |
