diff options
| -rwxr-xr-x | challenge-261/wanderdoc/perl/ch-1.pl | 59 | ||||
| -rwxr-xr-x | challenge-261/wanderdoc/perl/ch-2.pl | 49 | ||||
| -rw-r--r-- | stats/pwc-current.json | 215 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 62 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1598 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 360 | ||||
| -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 | 94 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 58 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 114 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-301-330.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 658 |
18 files changed, 1969 insertions, 1846 deletions
diff --git a/challenge-261/wanderdoc/perl/ch-1.pl b/challenge-261/wanderdoc/perl/ch-1.pl new file mode 100755 index 0000000000..d5d7b440db --- /dev/null +++ b/challenge-261/wanderdoc/perl/ch-1.pl @@ -0,0 +1,59 @@ +#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+You are given an array of integers, @ints. Write a script to evaluate the absolute difference between element and digit sum of the given array.
+
+Example 1 Input: @ints = (1,2,3,45) Output: 36
+
+Element Sum: 1 + 2 + 3 + 45 = 51
+Digit Sum: 1 + 2 + 3 + 4 + 5 = 15
+Absolute Difference: | 51 - 15 | = 36
+
+Example 2 Input: @ints = (1,12,3) Output: 9
+
+Element Sum: 1 + 12 + 3 = 16
+Digit Sum: 1 + 1 + 2 + 3 = 7
+Absolute Difference: | 16 - 7 | = 9
+
+Example 3 Input: @ints = (1,2,3,4) Output: 0
+
+Element Sum: 1 + 2 + 3 + 4 = 10
+Digit Sum: 1 + 2 + 3 + 4 = 10
+Absolute Difference: | 10 - 10 | = 0
+
+Example 4
+
+Input: @ints = (236, 416, 336, 350) Output: 1296
+=cut
+
+
+use List::Util qw(sum);
+use Test2::V0;
+
+is(sum_diff(1,2,3,45), 36, 'Example 1');
+is(sum_diff(1,12,3), 9, 'Example 2');
+is(sum_diff(1,2,3,4), 0, 'Example 3');
+is(sum_diff(236, 416, 336, 350), 1296, 'Example 4');
+
+
+done_testing();
+
+sub sum_diff
+{
+ my @arr = @_;
+ my $elm_sum = sum(@arr);
+ my $dig_sum = sum(map digit_sum($_), @arr);
+ my $diff = abs($elm_sum - $dig_sum);
+ return $diff;
+
+}
+
+sub digit_sum
+{
+ my $num = $_[0];
+ my @arr = split(//, $num);
+ my $sum = sum(@arr);
+ return $sum;
+}
\ No newline at end of file diff --git a/challenge-261/wanderdoc/perl/ch-2.pl b/challenge-261/wanderdoc/perl/ch-2.pl new file mode 100755 index 0000000000..9c2dd3a813 --- /dev/null +++ b/challenge-261/wanderdoc/perl/ch-2.pl @@ -0,0 +1,49 @@ +#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+You are given an array of integers, @ints and an integer $start..
+Write a script to do the followings:
+a) Look for $start in the array @ints, if found multiply the number by 2
+b) If not found stop the process otherwise repeat
+In the end return the final value.
+
+Example 1 Input: @ints = (5,3,6,1,12) and $start = 3 Output: 24
+
+Step 1: 3 is in the array so 3 x 2 = 6
+Step 2: 6 is in the array so 6 x 2 = 12
+Step 3: 12 is in the array so 12 x 2 = 24
+
+24 is not found in the array so return 24.
+
+Example 2 Input: @ints = (1,2,4,3) and $start = 1 Output: 8
+
+Step 1: 1 is in the array so 1 x 2 = 2
+Step 2: 2 is in the array so 2 x 2 = 4
+Step 3: 4 is in the array so 4 x 2 = 8
+
+8 is not found in the array so return 8.
+
+Example 3 Input: @ints = (5,6,7) and $start = 2 Output: 2
+ 2 is not found in the array so return 2.
+=cut
+
+use Test2::V0;
+
+is(multiply_by_two([5,3,6,1,12], 3), 24, 'Example 1');
+is(multiply_by_two([1,2,3,4], 1), 8, 'Example 2');
+is(multiply_by_two([5,6,7], 2), 2, 'Example 3');
+done_testing();
+
+sub multiply_by_two
+{
+ my ($aref, $start) = @_;
+ my $scalar;
+ vec($scalar, $_, 1) = 1 for @$aref;
+ while ( vec($scalar, $start, 1) == 1 )
+ {
+ $start *= 2;
+ }
+ return $start;
+}
\ No newline at end of file diff --git a/stats/pwc-current.json b/stats/pwc-current.json index e9164cfe60..64aa556d92 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,4 +1,9 @@ { + "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/>" + }, "plotOptions" : { "series" : { "borderWidth" : 0, @@ -8,12 +13,10 @@ } } }, - "legend" : { - "enabled" : 0 - }, "drilldown" : { "series" : [ { + "id" : "Adam Russell", "name" : "Adam Russell", "data" : [ [ @@ -24,8 +27,7 @@ "Blog", 1 ] - ], - "id" : "Adam Russell" + ] }, { "name" : "Ali Moradi", @@ -38,17 +40,17 @@ "id" : "Ali Moradi" }, { - "id" : "Andrew Shitov", "name" : "Andrew Shitov", "data" : [ [ "Raku", 2 ] - ] + ], + "id" : "Andrew Shitov" }, { - "name" : "Arne Sommer", + "id" : "Arne Sommer", "data" : [ [ "Raku", @@ -59,19 +61,20 @@ 1 ] ], - "id" : "Arne Sommer" + "name" : "Arne Sommer" }, { - "id" : "Asher Harvey-Smith", + "name" : "Asher Harvey-Smith", "data" : [ [ "Raku", 2 ] ], - "name" : "Asher Harvey-Smith" + "id" : "Asher Harvey-Smith" }, { + "name" : "Athanasius", "data" : [ [ "Perl", @@ -82,30 +85,30 @@ 2 ] ], - "name" : "Athanasius", "id" : "Athanasius" }, { + "id" : "Bob Lied", "data" : [ [ "Perl", 2 ] ], - "name" : "Bob Lied", - "id" : "Bob Lied" + "name" : "Bob Lied" }, { - "name" : "Bruce Gray", "data" : [ [ "Raku", 2 ] ], + "name" : "Bruce Gray", "id" : "Bruce Gray" }, { + "id" : "Dave Jacoby", "data" : [ [ "Perl", @@ -116,28 +119,27 @@ 1 ] ], - "name" : "Dave Jacoby", - "id" : "Dave Jacoby" + "name" : "Dave Jacoby" }, { + "id" : "David Ferrone", "name" : "David Ferrone", "data" : [ [ "Perl", 2 ] - ], - "id" : "David Ferrone" + ] }, { "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "name" : "E. Choroba" + ] }, { "id" : "Feng Chang", @@ -160,7 +162,6 @@ "name" : "Jan Krnavek" }, { - "id" : "Jorg Sommrey", "name" : "Jorg Sommrey", "data" : [ [ @@ -171,7 +172,8 @@ "Blog", 1 ] - ] + ], + "id" : "Jorg Sommrey" }, { "id" : "Lance Wicks", @@ -202,18 +204,17 @@ "name" : "Laurent Rosenfeld" }, { + "id" : "Lubos Kolouch", + "name" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ], - "name" : "Lubos Kolouch", - "id" : "Lubos Kolouch" + ] }, { "id" : "Luca Ferrari", - "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -223,7 +224,8 @@ "Blog", 9 ] - ] + ], + "name" : "Luca Ferrari" }, { "data" : [ @@ -236,33 +238,33 @@ "id" : "Mariano Spadaccini" }, { + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson", "id" : "Mark Anderson" }, { + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] - ], - "name" : "Matthew Neleigh", - "id" : "Matthew Neleigh" + ] }, { - "name" : "Nelo Tovar", "data" : [ [ "Perl", 2 ] ], + "name" : "Nelo Tovar", "id" : "Nelo Tovar" }, { @@ -276,6 +278,7 @@ "id" : "Niels van Dijke" }, { + "id" : "Packy Anderson", "name" : "Packy Anderson", "data" : [ [ @@ -290,10 +293,10 @@ "Blog", 1 ] - ], - "id" : "Packy Anderson" + ] }, { + "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -304,21 +307,19 @@ 1 ] ], - "name" : "Peter Campbell Smith", "id" : "Peter Campbell Smith" }, { + "name" : "Peter Meszaros", "data" : [ [ "Perl", 2 ] ], - "name" : "Peter Meszaros", "id" : "Peter Meszaros" }, { - "id" : "Robbie Hatley", "name" : "Robbie Hatley", "data" : [ [ @@ -329,10 +330,11 @@ "Blog", 1 ] - ] + ], + "id" : "Robbie Hatley" }, { - "id" : "Roger Bell_West", + "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -347,7 +349,7 @@ 1 ] ], - "name" : "Roger Bell_West" + "id" : "Roger Bell_West" }, { "name" : "Simon Green", @@ -364,7 +366,6 @@ "id" : "Simon Green" }, { - "id" : "Thomas Kohler", "name" : "Thomas Kohler", "data" : [ [ @@ -375,11 +376,11 @@ "Blog", 2 ] - ] + ], + "id" : "Thomas Kohler" }, { "id" : "Ulrich Rieke", - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -389,11 +390,10 @@ "Raku", 2 ] - ] + ], + "name" : "Ulrich Rieke" }, { - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -403,12 +403,31 @@ "Blog", 1 ] - ] + ], + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan" + }, + { + "id" : "Wanderdoc", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Wanderdoc" } ] }, + "subtitle" : { + "text" : "[Champions: 33] Last updated at 2024-03-24 17:28:02 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 261" + }, "series" : [ { + "colorByPoint" : 1, "name" : "The Weekly Challenge - 261", "data" : [ { @@ -422,14 +441,14 @@ "y" : 2 }, { + "drilldown" : "Andrew Shitov", "name" : "Andrew Shitov", - "y" : 2, - "drilldown" : "Andrew Shitov" + "y" : 2 }, { + "drilldown" : "Arne Sommer", "y" : 3, - "name" : "Arne Sommer", - "drilldown" : "Arne Sommer" + "name" : "Arne Sommer" }, { "drilldown" : "Asher Harvey-Smith", @@ -437,9 +456,9 @@ "y" : 2 }, { - "drilldown" : "Athanasius", + "name" : "Athanasius", "y" : 4, - "name" : "Athanasius" + "drilldown" : "Athanasius" }, { "drilldown" : "Bob Lied", @@ -447,14 +466,14 @@ "y" : 2 }, { - "y" : 2, "name" : "Bruce Gray", + "y" : 2, "drilldown" : "Bruce Gray" }, { "drilldown" : "Dave Jacoby", - "y" : 3, - "name" : "Dave Jacoby" + "name" : "Dave Jacoby", + "y" : 3 }, { "drilldown" : "David Ferrone", @@ -462,9 +481,9 @@ "name" : "David Ferrone" }, { - "drilldown" : "E. Choroba", "name" : "E. Choroba", - "y" : 2 + "y" : 2, + "drilldown" : "E. Choroba" }, { "drilldown" : "Feng Chang", @@ -472,39 +491,39 @@ "y" : 2 }, { + "drilldown" : "Jan Krnavek", "y" : 2, - "name" : "Jan Krnavek", - "drilldown" : "Jan Krnavek" + "name" : "Jan Krnavek" }, { - "drilldown" : "Jorg Sommrey", "name" : "Jorg Sommrey", - "y" : 3 + "y" : 3, + "drilldown" : "Jorg Sommrey" }, { - "drilldown" : "Lance Wicks", + "y" : 1, "name" : "Lance Wicks", - "y" : 1 + "drilldown" : "Lance Wicks" }, { - "y" : 6, + "drilldown" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", - "drilldown" : "Laurent Rosenfeld" + "y" : 6 }, { - "y" : 2, "name" : "Lubos Kolouch", + "y" : 2, "drilldown" : "Lubos Kolouch" }, { + "drilldown" : "Luca Ferrari", "name" : "Luca Ferrari", - "y" : 11, - "drilldown" : "Luca Ferrari" + "y" : 11 }, { "drilldown" : "Mariano Spadaccini", - "name" : "Mariano Spadaccini", - "y" : 2 + "y" : 2, + "name" : "Mariano Spadaccini" }, { "drilldown" : "Mark Anderson", @@ -517,14 +536,14 @@ "y" : 2 }, { + "drilldown" : "Nelo Tovar", "name" : "Nelo Tovar", - "y" : 2, - "drilldown" : "Nelo Tovar" + "y" : 2 }, { - "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke", "y" : 2, - "drilldown" : "Niels van Dijke" + "name" : "Niels van Dijke" }, { "y" : 5, @@ -532,9 +551,9 @@ "drilldown" : "Packy Anderson" }, { - "drilldown" : "Peter Campbell Smith", "y" : 3, - "name" : "Peter Campbell Smith" + "name" : "Peter Campbell Smith", + "drilldown" : "Peter Campbell Smith" }, { "name" : "Peter Meszaros", @@ -548,8 +567,8 @@ }, { "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West", - "y" : 5 + "y" : 5, + "name" : "Roger Bell_West" }, { "y" : 3, @@ -558,8 +577,8 @@ }, { "drilldown" : "Thomas Kohler", - "name" : "Thomas Kohler", - "y" : 4 + "y" : 4, + "name" : "Thomas Kohler" }, { "name" : "Ulrich Rieke", @@ -567,34 +586,30 @@ "drilldown" : "Ulrich Rieke" }, { - "y" : 3, + "drilldown" : "W. Luis Mochan", "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" + "y" : 3 + }, + { + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc", + "y" : 2 } - ], - "colorByPoint" : 1 + ] } ], - "subtitle" : { - "text" : "[Champions: 32] Last updated at 2024-03-24 16:34:03 GMT" - }, - "chart" : { - "type" : "column" + "xAxis" : { + "type" : "category" }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "xAxis" : { - "type" : "category" - }, - "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/>" + "legend" : { + "enabled" : 0 }, - "title" : { - "text" : "The Weekly Challenge - 261" + "chart" : { + "type" : "column" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index bfd4ab3d36..0d760aaadb 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,19 +1,30 @@ { + "legend" : { + "enabled" : "false" + }, + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, "series" : [ { "dataLabels" : { - "y" : 10, - "align" : "right", - "color" : "#FFFFFF", "enabled" : "true", - "rotation" : -90, - "format" : "{point.y:.0f}", "style" : { "fontSize" : "13px", "fontFamily" : "Verdana, sans-serif" - } + }, + "y" : 10, + "align" : "right", + "color" : "#FFFFFF", + "format" : "{point.y:.0f}", + "rotation" : -90 }, - "name" : "Contributions", "data" : [ [ "Blog", @@ -21,23 +32,24 @@ ], [ "Perl", - 13513 + 13515 ], [ "Raku", 7841 ] - ] + ], + "name" : "Contributions" } ], - "subtitle" : { - "text" : "Last updated at 2024-03-24 16:34:03 GMT" - }, - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : "false" + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + } }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2024]" @@ -45,19 +57,7 @@ "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } - }, - "xAxis" : { - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "type" : "category" + "subtitle" : { + "text" : "Last updated at 2024-03-24 17:28:01 GMT" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 233bbbaf32..13b37b59f4 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,16 +1,23 @@ { + "title" : { + "text" : "The Weekly Challenge Language" + }, + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2024-03-24 17:28:02 GMT" + }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 + "format" : "{point.y}", + "enabled" : 1 + } } }, "drilldown" : { "series" : [ { + "id" : "001", "data" : [ [ "Perl", @@ -25,12 +32,9 @@ 12 ] ], - "name" : "001", - "id" : "001" + "name" : "001" }, { - "id" : "002", - "name" : "002", "data" : [ [ "Perl", @@ -44,7 +48,9 @@ "Blog", 10 ] - ] + ], + "name" : "002", + "id" : "002" }, { "id" : "003", @@ -65,7 +71,7 @@ "name" : "003" }, { - "name" : "004", + "id" : "004", "data" : [ [ "Perl", @@ -80,9 +86,10 @@ 10 ] ], - "id" : "004" + "name" : "004" }, { + "id" : "005", "name" : "005", "data" : [ [ @@ -97,12 +104,9 @@ "Blog", 12 ] - ], - "id" : "005" + ] }, { - "id" : "006", - "name" : "006", "data" : [ [ "Perl", @@ -116,9 +120,12 @@ "Blog", 7 ] - ] + ], + "name" : "006", + "id" : "006" }, { + "name" : "007", "data" : [ [ "Perl", @@ -133,10 +140,11 @@ 10 ] ], - "name" : "007", "id" : "007" }, { + "id" : "008", + "name" : "008", "data" : [ [ "Perl", @@ -150,12 +158,9 @@ "Blog", 12 ] - ], - "name" : "008", - "id" : "008" + ] }, { - "id" : "009", "name" : "009", "data" : [ [ @@ -170,10 +175,10 @@ "Blog", 13 ] - ] + ], + "id" : "009" }, { - "id" : "010", "name" : "010", "data" : [ [ @@ -188,9 +193,11 @@ "Blog", 11 ] - ] + ], + "id" : "010" }, { + "name" : "011", "data" : [ [ "Perl", @@ -205,12 +212,9 @@ 10 ] ], - "name" : "011", "id" : "011" }, { - "id" : "012", - "name" : "012", "data" : [ [ "Perl", @@ -224,10 +228,11 @@ "Blog", 11 ] - ] + ], + "name" : "012", + "id" : "012" }, { - "id" : "013", "name" : "013", "data" : [ [ @@ -242,11 +247,11 @@ "Blog", 13 ] - ] + ], + "id" : "013" }, { "id" : "014", - "name" : "014", "data" : [ [ "Perl", @@ -260,9 +265,11 @@ "Blog", 15 ] - ] + ], + "name" : "014" }, { + "name" : "015", "data" : [ [ "Perl", @@ -277,11 +284,10 @@ 15 ] ], - "name" : "015", "id" : "015" }, { - "name" : "016", + "id" : "016", "data" : [ [ "Perl", @@ -296,11 +302,9 @@ 13 ] ], - "id" : "016" + "name" : "016" }, { - "id" : "017", - "name" : "017", "data" : [ [ "Perl", @@ -314,7 +318,9 @@ "Blog", 12 ] - ] + ], + "name" : "017", + "id" : "017" }, { "id" : "018", @@ -335,6 +341,7 @@ ] }, { + "id" : "019", "data" : [ [ "Perl", @@ -349,11 +356,9 @@ 13 ] ], - "name" : "019", - "id" : "019" + "name" : "019" }, { - "name" : "020", "data" : [ [ "Perl", @@ -368,10 +373,11 @@ 13 ] ], + "name" : "020", "id" : "020" }, { - "name" : "021", + "id" : "021", "data" : [ [ "Perl", @@ -386,9 +392,10 @@ 10 ] ], - "id" : "021" + "name" : "021" }, { + "id" : "022", "name" : "022", "data" : [ [ @@ -403,11 +410,9 @@ "Blog", 10 ] - ], - "id" : "022" + ] }, { - "id" : "023", "name" : "023", "data" : [ [ @@ -422,9 +427,11 @@ "Blog", 12 ] - |
