diff options
| -rw-r--r-- | challenge-196/colin-crain/blog.txt | 1 | ||||
| -rwxr-xr-x | challenge-196/colin-crain/perl/ch-1.pl | 79 | ||||
| -rwxr-xr-x | challenge-196/colin-crain/perl/ch-2.pl | 108 | ||||
| -rw-r--r-- | stats/pwc-current.json | 521 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 66 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1272 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 810 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 36 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 32 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 110 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 38 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 56 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 56 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 112 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 72 |
18 files changed, 1935 insertions, 1622 deletions
diff --git a/challenge-196/colin-crain/blog.txt b/challenge-196/colin-crain/blog.txt new file mode 100644 index 0000000000..f6b74c6c5f --- /dev/null +++ b/challenge-196/colin-crain/blog.txt @@ -0,0 +1 @@ +https://colincrain.com/2022/12/25/range-rover-over-clover diff --git a/challenge-196/colin-crain/perl/ch-1.pl b/challenge-196/colin-crain/perl/ch-1.pl new file mode 100755 index 0000000000..80d36a56dd --- /dev/null +++ b/challenge-196/colin-crain/perl/ch-1.pl @@ -0,0 +1,79 @@ +#!/Users/colincrain/perl5/perlbrew/perls/perl-5.32.0/bin/perl
+#
+# room-132.pl
+#
+# Pattern 132
+# Submitted by: Mohammad S Anwar
+# You are given a list of integers, @list.
+#
+# Write a script to find out subsequence that respect Pattern 132.
+# Return empty array if none found.
+#
+# Pattern 132 in a sequence (a[i], a[j], a[k]) such that
+# i < j < k and a[i] < a[k] < a[j].
+#
+# Example 1
+# Input: @list = (3, 1, 4, 2)
+# Output: (1, 4, 2) respect the Pattern 132.
+#
+# Example 2
+# Input: @list = (1, 2, 3, 4)
+# Output: () since no susbsequence can be found.
+#
+# Example 3
+# Input: @list = (1, 3, 2, 4, 6, 5)
+# Output: (1, 3, 2) if more than one subsequence found then return the first.
+#
+# Example 4
+# Input: @list = (1, 3, 4, 2)
+# Output: (1, 3, 2)
+#
+# method
+#
+# rearranging the pattern, I think it will be easier to search
+# backwards from the third element instead of looking ahead from
+# the first. Which means we can iterate across the input array
+# starting at the third elemnet, then, backtracking to the first,
+# find the first element less than the value at the start, and then
+# continue closing from that point forward intil we are back to the
+# start position, looking for a value greater than the start. If we
+# find both other elements we will have found the leftmost match of
+# the pattern.
+
+
+#
+#
+# © 2022 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+
+
+use warnings;
+use strict;
+use utf8;
+use feature ":5.26";
+use feature qw(signatures);
+no warnings 'experimental::signatures';
+
+
+my @array = (1, 3, 4, 2);
+my @match;
+my ($first, $second, $third);
+
+OUTER: for my $start (2..$#array) {
+ for my $idx (0..$start-1) {
+ $first = $array[$idx] if $array[$idx] < $array[$start];
+ if (defined($first) && ($array[$idx] > $array[$start])) {
+ @match = ($first, $array[$idx], $array[$start]);
+ last OUTER;
+ }
+ }
+ undef $first;
+}
+
+print '(', (join ', ', @match), ')';
+
+
+
+
+
diff --git a/challenge-196/colin-crain/perl/ch-2.pl b/challenge-196/colin-crain/perl/ch-2.pl new file mode 100755 index 0000000000..aac3c0b371 --- /dev/null +++ b/challenge-196/colin-crain/perl/ch-2.pl @@ -0,0 +1,108 @@ +#!/Users/colincrain/perl5/perlbrew/perls/perl-5.32.0/bin/perl
+#
+# down-range.pl
+#
+# Range List
+# Submitted by: Mohammad S Anwar
+# You are given a sorted unique integer array, @array.
+#
+# Write a script to find all possible Number Range i.e [x, y]
+# represent range all integers from x and y (both inclusive).
+#
+# Each subsequence of two or more contiguous integers
+#
+# Example 1
+# Input: @array = (1,3,4,5,7)
+# Output: [3,5]
+#
+# Example 2
+# Input: @array = (1,2,3,6,7,9)
+# Output: [1,3], [6,7]
+#
+# Example 3
+# Input: @array = (0,1,2,4,5,6,8,9)
+# Output: [0,2], [4,6], [8,9]
+
+# breakdown
+#
+# I had to read this and study the examples several times before I
+# got the jist of what was being requested here. Rephrased, we are
+# given a list of ascending integers, and are asked to isolate out
+# contiguous runs of sequental values that can be represented with
+# ranges, and return the ranges.
+#
+# Ranges fro the purposes of discussion are assumed to have the
+# most restrained and basic definition: sequential ascending values
+# differing by 1. No funny stuff.
+#
+# An immediastely useful observation that will make our search
+# simpler is that the ranges cannot overlap or even abut, and this
+# will immediately stimulate reverse mitosis and the two ranges
+# will spontaniously merge into one single larger element. So as we
+# look for ranges, we know they will have distinct boundaries.
+#
+# method
+#
+# The essental pattern to recognize here is two seqential elements
+# in the input array that increase in value by 1. If we walk the
+# list from left to right, then, if the next element differs from
+# the previous by 1, it is in a range with it, and if the
+# difference is any other number it is not.
+#
+# What we can do, then, is iterate over the indices of the target
+# array from 0 to the second-to-last. Looking at each index value,
+# if the next index value is one more we have a range, with a low
+# of the current index and a high of the next. Moving to the next,
+# if the difference is 1 again we extend the working range making
+# that value the new high. If it is not in the range, however, the
+# current range is closed as-is and stored away or even printed
+# immediately, and then the working range is wiped clean.
+#
+# After evaluating the second-to-last index, if we still have a
+# working range it is added to the output, but if that range is nil
+# it is left off.
+#
+# In this way we can process the whole array in one pass.
+#
+#
+# I seem to recall another challenge that was solvable using a very
+# similar strategy, perhaps with intervals.
+
+
+#
+# © 2022 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+
+
+use warnings;
+use strict;
+use utf8;
+use feature ":5.26";
+use feature qw(signatures);
+no warnings 'experimental::signatures';
+
+
+
+my @array = (0,1,2,4,5,6,8,9);
+my @working;
+my @ranges;
+
+for (0..$#array-1) {
+ if ($array[$_+1] - $array[$_] == 1) {
+ $working[0] //= $array[$_ ];
+ $working[1] = $array[$_+1];
+ next;
+ }
+ push @ranges, [ @working ] if @working;
+ @working = ();
+}
+
+push @ranges, [ @working ] if @working;
+
+
+say q([) . (join ',', $_->@*) . q(]) for @ranges;
+
+
+
+
diff --git a/stats/pwc-current.json b/stats/pwc-current.json index d8a4300a42..1c4f6bde70 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,191 +1,63 @@ { - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } - }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 196", - "data" : [ - { - "name" : "Athanasius", - "y" : 4, - "drilldown" : "Athanasius" - }, - { - "name" : "Bob Lied", - "y" : 2, - "drilldown" : "Bob Lied" - }, - { - "drilldown" : "Carlos Oliveira", - "name" : "Carlos Oliveira", - "y" : 2 - }, - { - "y" : 3, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" - }, - { - "name" : "David Ferrone", - "y" : 2, - "drilldown" : "David Ferrone" - }, - { - "name" : "E. Choroba", - "y" : 2, - "drilldown" : "E. Choroba" - }, - { - "drilldown" : "Feng Chang", - "y" : 2, - "name" : "Feng Chang" - }, - { - "drilldown" : "James Smith", - "y" : 3, - "name" : "James Smith" - }, - { - "name" : "Jorg Sommrey", - "y" : 2, - "drilldown" : "Jorg Sommrey" - }, - { - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld", - "y" : 5 - }, - { - "y" : 8, - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari" - }, - { - "name" : "Mark Anderson", - "y" : 2, - "drilldown" : "Mark Anderson" - }, - { - "drilldown" : "Niels van Dijke", - "name" : "Niels van Dijke", - "y" : 2 - }, - { - "name" : "Peter Campbell Smith", - "y" : 3, - "drilldown" : "Peter Campbell Smith" - }, - { - "drilldown" : "Pip Stuart", - "name" : "Pip Stuart", - "y" : 2 - }, - { - "drilldown" : "Robbie Hatley", - "y" : 2, - "name" : "Robbie Hatley" - }, - { - "drilldown" : "Robert DiCicco", - "name" : "Robert DiCicco", - "y" : 1 - }, - { - "drilldown" : "Robert Ransbottom", - "name" : "Robert Ransbottom", - "y" : 2 - }, - { - "name" : "Roger Bell_West", - "y" : 4, - "drilldown" : "Roger Bell_West" - }, - { - "y" : 3, - "name" : "Simon Green", - "drilldown" : "Simon Green" - }, - { - "drilldown" : "Stephen G. Lynn", - "name" : "Stephen G. Lynn", - "y" : 5 - }, - { - "y" : 3, - "name" : "Thomas Kohler", - "drilldown" : "Thomas Kohler" - }, - { - "y" : 4, - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke" - }, - { - "y" : 3, - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" - } - ] - } - ], - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "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: 24] Last updated at 2022-12-24 08:52:23 GMT" - }, - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "The Weekly Challenge - 196" - }, - "xAxis" : { - "type" : "category" - }, "drilldown" : { "series" : [ { - "name" : "Athanasius", "data" : [ [ "Perl", 2 - ], + ] + ], + "id" : "Adam Russell", + "name" : "Adam Russell" + }, + { + "data" : [ [ "Raku", 2 + ], + [ + "Blog", + 1 ] ], - "id" : "Athanasius" + "name" : "Arne Sommer", + "id" : "Arne Sommer" }, { + "id" : "Athanasius", + "name" : "Athanasius", "data" : [ [ "Perl", 2 + ], + [ + "Raku", + 2 ] - ], + ] + }, + { + "name" : "Bob Lied", "id" : "Bob Lied", - "name" : "Bob Lied" + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Bruce Gray", + "id" : "Bruce Gray", + "data" : [ + [ + "Raku", + 2 + ] + ] }, { "name" : "Carlos Oliveira", @@ -198,7 +70,16 @@ ] }, { - "id" : "Dave Jacoby", + "id" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { "data" : [ [ "Perl", @@ -209,11 +90,36 @@ 1 ] ], - "name" : "Dave Jacoby" + "name" : "Colin Crain", + "id" : "Colin Crain" }, { - "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Dave Jacoby", + "id" : "Dave Jacoby" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], "id" : "David Ferrone", + "name" : "David Ferrone" + }, + { + "name" : "Duncan C. White", + "id" : "Duncan C. White", "data" : [ [ "Perl", @@ -222,18 +128,18 @@ ] }, { - "name" : "E. Choroba", - "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "E. Choroba", + "name" : "E. Choroba" }, { - "name" : "Feng Chang", "id" : "Feng Chang", + "name" : "Feng Chang", "data" : [ [ "Raku", @@ -242,32 +148,48 @@ ] }, { - "id" : "James Smith", + "id" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas", "data" : [ [ "Perl", 2 ], [ + "Raku", + 2 + ], + [ "Blog", 1 ] - ], - "name" : "James Smith" + ] }, { "data" : [ [ "Perl", 2 + ], + [ + "Blog", + 1 ] ], + "id" : "James Smith", + "name" : "James Smith" + }, + { "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey" + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ] + ] }, { - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -281,10 +203,11 @@ "Blog", 1 ] - ] + ], + "name" : "Laurent Rosenfeld", + "id" : "Laurent Rosenfeld" }, { - "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -295,17 +218,18 @@ 6 ] ], - "id" : "Luca Ferrari" + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" }, { + "id" : "Mark Anderson", "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] - ], - "id" : "Mark Anderson" + ] }, { "name" : "Niels van Dijke", @@ -318,7 +242,6 @@ ] }, { - "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -329,50 +252,50 @@ 1 ] ], + "name" : "Peter Campbell Smith", "id" : "Peter Campbell Smith" }, { - "id" : "Pip Stuart", "data" : [ [ "Perl", 2 ] ], - "name" : "Pip Stuart" + "name" : "Pip Stuart", + "id" : "Pip Stuart" }, { - "name" : "Robbie Hatley", "data" : [ [ "Perl", 2 ] ], + "name" : "Robbie Hatley", "id" : "Robbie Hatley" }, { + "name" : "Robert DiCicco", "id" : "Robert DiCicco", "data" : [ [ "Raku", 1 ] - ], - "name" : "Robert DiCicco" + ] }, { - "id" : "Robert Ransbottom", "data" : [ [ "Raku", 2 ] ], + "id" : "Robert Ransbottom", "name" : "Robert Ransbottom" }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -381,9 +304,14 @@ [ "Raku", 2 + ], + [ + "Blog", + 1 ] ], - "name" : "Roger Bell_West" + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" }, { "data" : [ @@ -400,7 +328,6 @@ "name" : "Simon Green" }, { - "name" : "Stephen G. Lynn", "data" : [ [ "Perl", @@ -415,11 +342,12 @@ 1 ] ], + "name" : "Stephen G. Lynn", "id" : "Stephen G. Lynn" }, { - "name" : "Thomas Kohler", "id" : "Thomas Kohler", + "name" : "Thomas Kohler", "data" : [ [ "Perl", @@ -432,7 +360,6 @@ ] }, { - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -443,10 +370,10 @@ 2 ] ], + "name" : "Ulrich Rieke", "id" : "Ulrich Rieke" }, { - "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -457,8 +384,206 @@ 1 ] ], + "id" : "W. Luis Mochan", "name" : "W. Luis Mochan" } ] + }, + "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/>" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "subtitle" : { + "text" : "[Champions: 31] Last updated at 2022-12-26 01:39:44 GMT" + }, + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "data" : [ + { + "drilldown" : "Adam Russell", + "name" : "Adam Russell", + "y" : 2 + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "y" : 4, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "drilldown" : "Bob Lied", + "name" : "Bob Lied", + "y" : 2 + }, + { + "y" : 2, + "name" : "Bruce Gray", + "drilldown" : "Bruce Gray" + }, + { + "y" : 2, + "name" : "Carlos Oliveira", + "drilldown" : "Carlos Oliveira" + }, + { + "name" : "Cheok-Yin Fung", + "y" : 2, + "drilldown" : "Cheok-Yin Fung" + }, + { + "y" : 3, + "name" : "Colin Crain", + "drilldown" : "Colin Crain" + }, + { + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby", + "y" : 3 + }, + { + "drilldown" : "David Ferrone", + "name" : "David Ferrone", + "y" : 2 + }, + { + "name" : "Duncan C. White", + "y" : 2, + "drilldown" : "Duncan C. White" + }, + { + "drilldown" : "E. Choroba", + "y" : 2, + "name" : "E. Choroba" + }, + { + "name" : "Feng Chang", + "y" : 2, + "drilldown" : "Feng Chang" + }, + { + "drilldown" : "Jaldhar H. Vyas", + "y" : 5, + "name" : "Jaldhar H. Vyas" + }, + { + "y" : 3, + "name" : "James Smith", + "drilldown" : "James Smith" + }, + { + "y" : 2, + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey" + }, + { + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", + "y" : 5 + }, + { + "drilldown" : "Luca Ferrari", + "y" : 8, + "name" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "y" : 2, + "name" : "Mark Anderson" + }, + { + "y" : 2, + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke" + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "name" : "Pip Stuart", + "y" : 2, + "drilldown" : "Pip Stuart" + }, + { + "name" : "Robbie Hatley", + "y" : 2, + "drilldown" : "Robbie Hatley" + }, + { + "name" : "Robert DiCicco", + "y" : 1, + "drilldown" : "Robert DiCicco" + }, + { + "y" : 2, + "name" : "Robert Ransbottom", + "drilldown" : "Robert Ransbottom" + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 5 + }, + { + "drilldown" : "Simon Green", + "y" : 3, + "name" : "Simon Green" + }, + { + "name" : "Stephen G. Lynn", + "y" : 5, + "drilldown" : "Stephen G. Lynn" + }, + { + "name" : "Thomas Kohler", + "y" : 3, + "drilldown" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "y" : 4, + "drilldown" : "Ulrich Rieke" + }, + { + "y" : 3, + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan" + } + ], + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 196" + } + ], + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "xAxis" : { + "type" : "category" + }, + "title" : { + "text" : "The Weekly Challenge - 196" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 30e0d75aaf..95cf33e96e 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { + "subtitle" : { + "text" : "Last updated at 2022-12-26 01:39:44 GMT" + }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2022]" }, - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" }, "series" : [ { - "name" : "Contributions", + "dataLabels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "enabled" : "true", + "align" : "right", + "rotation" : -90, + "color" : "#FFFFFF", + "y" : 10, + "format" : "{point.y:.0f}" + }, "data" : [ [ "Blog", - 3131 + 3135 ], [ "Perl", - 9638 + 9648 ], [ "Raku", - 5776 + 5782 ] ], - "dataLabels" : { - "color" : "#FFFFFF", - "enabled" : "true", - "rotation" : -90, - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - }, - "y" : 10, - "format" : "{point.y:.0f}", - "align" : "right" - } + "name" : "Contributions" } ], "legend" : { "enabled" : "false" }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" - }, - "subtitle" : { - "text" : "Last updated at 2022-12-24 08:52:23 GMT" - }, - "chart" : { - "type" : "column" - }, "yAxis" : { "min" : 0, "title" : { "text" : null } + }, + "chart" : { + "type" : "column" + }, + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + } } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index a2b3349077..10db92b2c9 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,20 +1,29 @@ { - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 + "title" : { + "text" : "The Weekly Challenge Language" + }, + "xAxis" : { + "type" : "category" + }, + "chart" : { + "type" : "column" + }, + "yAxis" : |
