diff options
| -rw-r--r-- | challenge-094/colin-crain/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-094/colin-crain/perl/ch-1.pl | 83 | ||||
| -rw-r--r-- | challenge-094/colin-crain/raku/ch-1.raku | 29 | ||||
| -rw-r--r-- | stats/pwc-current.json | 503 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 74 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 720 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 392 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 122 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 106 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 42 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 44 |
16 files changed, 1288 insertions, 1152 deletions
diff --git a/challenge-094/colin-crain/blog.txt b/challenge-094/colin-crain/blog.txt new file mode 100644 index 0000000000..8177690461 --- /dev/null +++ b/challenge-094/colin-crain/blog.txt @@ -0,0 +1 @@ +https://colincrain.com/2021/01/11/anagram-nut-clusters/ diff --git a/challenge-094/colin-crain/perl/ch-1.pl b/challenge-094/colin-crain/perl/ch-1.pl new file mode 100644 index 0000000000..8a5be4cd03 --- /dev/null +++ b/challenge-094/colin-crain/perl/ch-1.pl @@ -0,0 +1,83 @@ +#! /opt/local/bin/perl
+#
+# anagram_clusters.pl
+#
+# TASK #1 › Group Anagrams
+# Submitted by: Mohammad S Anwar
+# You are given an array of strings @S.
+#
+# Write a script to group Anagrams together in any random order.
+#
+# An Anagram is a word or phrase formed by rearranging the letters of a
+# different word or phrase, typically using all the original letters
+# exactly once.
+#
+# Example 1:
+# Input: ("opt", "bat", "saw", "tab", "pot", "top", "was")
+# Output: [ ("bat", "tab"),
+# ("saw", "was"),
+# ("top", "pot", "opt") ]
+# Example 2:
+# Input: ("x")
+# Output: [ ("x") ]
+
+# method:
+# I think the definition of an anagram, while nice, and
+# important mind you, is in the end a little less useful than a more
+# definitive rephrasing of the first sentence would be. I have to
+# say I couldn't make heads or tails of it the first time I read it.
+# Wait, what anagrams of what? Grouping random anagrams? From where again?
+#
+# After carefully deconstructing the examples it did become clear
+# what was expected, so let's try that rephrase: "Given a list of
+# strings, group together in any order those strings that represent
+# anagrams of each other." Does that make more sense? In the frist
+# example, "bat" and "tab" are anagrams, as are "saw" and "was", and
+# "top", "pot" and "opt".
+
+# To do this we'll need only to know how many of each letter compose
+# the word, the order is unimportant. The easiest way to do that is
+# to sort the letters and keep the count in unary notation, such as
+# converting the word notation into ainnoott. Any other anagram will
+# convert to the same form, so if we use it as a hash key, we can
+# keep the words that match as a list in the values.
+#
+# It's worth noting that hash keys, like the hashes themselves,
+# don't concern themselves much with physical size. Any string can
+# be used for a hash key; with non-interpolating single quotes any
+# character can be contined.
+
+
+# Reporting the key and their value lists gives us the result we
+# desire.
+#
+#
+#
+# 2020 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+
+
+use warnings;
+use strict;
+use feature ":5.26";
+
+## ## ## ## ## MAIN:
+
+@ARGV == 0 and @ARGV = ("Opt", "bat", "saw1", "tab", "po-t", "top", "wa's");
+
+my @list;
+for (@ARGV) {
+ s/[^a-zA-Z]//g;
+ push @list, lc $_;
+}
+
+my %letters;
+for (@list) {
+ my $str = join '', sort split //, $_;
+ push $letters{$str}->@*, $_;
+}
+
+say "@$_" for values %letters;
+
+
diff --git a/challenge-094/colin-crain/raku/ch-1.raku b/challenge-094/colin-crain/raku/ch-1.raku new file mode 100644 index 0000000000..49109fd218 --- /dev/null +++ b/challenge-094/colin-crain/raku/ch-1.raku @@ -0,0 +1,29 @@ +#!/usr/bin/env perl6
+#
+#
+# grouping_anagrams.raku
+#
+#
+#
+# 2020 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+
+
+unit sub MAIN (*@input) ;
+
+@input.elems == 0 and @input = "Opt", "bat", "saw1", "tab", "po-t", "top", "wa's";
+
+@input .= map: { .lc; };
+@input .= map: { S:g/<-[a..z]>// };
+
+my %lets;
+push %lets{ .comb.sort.join }, $_ for @input;
+
+.say for values %lets;
+
+
+
+
+
+
diff --git a/stats/pwc-current.json b/stats/pwc-current.json index c7dd291f0b..e967ae2655 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,21 +1,186 @@ { + "xAxis" : { + "type" : "category" + }, "chart" : { "type" : "column" }, + "series" : [ + { + "name" : "Perl Weekly Challenge - 094", + "colorByPoint" : 1, + "data" : [ + { + "name" : "Aaron Smith", + "y" : 3, + "drilldown" : "Aaron Smith" + }, + { + "drilldown" : "Abigail", + "name" : "Abigail", + "y" : 2 + }, + { + "name" : "Adam Russell", + "y" : 4, + "drilldown" : "Adam Russell" + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "name" : "Athanasius", + "y" : 4, + "drilldown" : "Athanasius" + }, + { + "y" : 3, + "name" : "Cheok-Yin Fung", + "drilldown" : "Cheok-Yin Fung" + }, + { + "y" : 3, + "name" : "Colin Crain", + "drilldown" : "Colin Crain" + }, + { + "name" : "Dave Jacoby", + "y" : 3, + "drilldown" : "Dave Jacoby" + }, + { + "drilldown" : "Duncan C. White", + "name" : "Duncan C. White", + "y" : 2 + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "drilldown" : "Flavio Poletti", + "name" : "Flavio Poletti", + "y" : 4 + }, + { + "drilldown" : "Gustavo Chaves", + "name" : "Gustavo Chaves", + "y" : 2 + }, + { + "drilldown" : "James Smith", + "y" : 3, + "name" : "James Smith" + }, + { + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek", + "y" : 2 + }, + { + "y" : 2, + "name" : "Joan Mimosinnet", + "drilldown" : "Joan Mimosinnet" + }, + { + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "y" : 2 + }, + { + "drilldown" : "Kang-min Liu", + "name" : "Kang-min Liu", + "y" : 3 + }, + { + "y" : 5, + "name" : "Laurent Rosenfeld", + "drilldown" : "Laurent Rosenfeld" + }, + { + "name" : "Lubos Kolouch", + "y" : 2, + "drilldown" : "Lubos Kolouch" + }, + { + "name" : "Luca Ferrari", + "y" : 4, + "drilldown" : "Luca Ferrari" + }, + { + "drilldown" : "Niels van Dijke", + "y" : 2, + "name" : "Niels van Dijke" + }, + { + "y" : 2, + "name" : "Nuno Vieira", + "drilldown" : "Nuno Vieira" + }, + { + "drilldown" : "Paulo Custodio", + "y" : 2, + "name" : "Paulo Custodio" + }, + { + "drilldown" : "Philip Hood", + "y" : 1, + "name" : "Philip Hood" + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 5 + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "y" : 1, + "name" : "Simon Proctor", + "drilldown" : "Simon Proctor" + }, + { + "name" : "Stuart Little", + "y" : 2, + "drilldown" : "Stuart Little" + }, + { + "drilldown" : "Ulrich Rieke", + "y" : 2, + "name" : "Ulrich Rieke" + }, + { + "y" : 3, + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan" + }, + { + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc", + "y" : 2 + } + ] + } + ], "subtitle" : { - "text" : "[Champions: 30] Last updated at 2021-01-10 21:31:15 GMT" - }, - "legend" : { - "enabled" : 0 + "text" : "[Champions: 31] Last updated at 2021-01-11 02:12:17 GMT" }, - "tooltip" : { - "followPointer" : 1, - "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/>" + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "drilldown" : { "series" : [ { + "name" : "Aaron Smith", + "id" : "Aaron Smith", "data" : [ [ "Raku", @@ -25,21 +190,21 @@ "Blog", 1 ] - ], - "id" : "Aaron Smith", - "name" : "Aaron Smith" + ] }, { - "id" : "Abigail", - "name" : "Abigail", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Abigail", + "name" : "Abigail" }, { + "id" : "Adam Russell", + "name" : "Adam Russell", "data" : [ [ "Perl", @@ -49,9 +214,7 @@ "Blog", 2 ] - ], - "name" : "Adam Russell", - "id" : "Adam Russell" + ] }, { "data" : [ @@ -64,12 +227,10 @@ 1 ] ], - "id" : "Arne Sommer", - "name" : "Arne Sommer" + "name" : "Arne Sommer", + "id" : "Arne Sommer" }, { - "id" : "Athanasius", - "name" : "Athanasius", "data" : [ [ "Perl", @@ -79,7 +240,9 @@ "Raku", 2 ] - ] + ], + "id" : "Athanasius", + "name" : "Athanasius" }, { "id" : "Cheok-Yin Fung", @@ -96,28 +259,46 @@ ] }, { - "id" : "Dave Jacoby", - "name" : "Dave Jacoby", "data" : [ [ "Perl", - 2 + 1 + ], + [ + "Raku", + 1 ], [ "Blog", 1 ] - ] + ], + "id" : "Colin Crain", + "name" : "Colin Crain" }, { "data" : [ [ "Perl", 2 + ], + [ + "Blog", + 1 ] ], + "id" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { "id" : "Duncan C. White", - "name" : "Duncan C. White" + "name" : "Duncan C. White", + "data" : [ + [ + "Perl", + 2 + ] + ] }, { "name" : "E. Choroba", @@ -130,8 +311,8 @@ ] }, { - "name" : "Flavio Poletti", "id" : "Flavio Poletti", + "name" : "Flavio Poletti", "data" : [ [ "Perl", @@ -144,18 +325,16 @@ ] }, { + "name" : "Gustavo Chaves", + "id" : "Gustavo Chaves", "data" : [ [ "Perl", 2 ] - ], - "name" : "Gustavo Chaves", - "id" : "Gustavo Chaves" + ] }, { - "name" : "James Smith", - "id" : "James Smith", "data" : [ [ "Perl", @@ -165,7 +344,9 @@ "Blog", 1 ] - ] + ], + "id" : "James Smith", + "name" : "James Smith" }, { "data" : [ @@ -188,16 +369,18 @@ "name" : "Joan Mimosinnet" }, { - "name" : "Jorg Sommrey", - "id" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey" }, { + "id" : "Kang-min Liu", + "name" : "Kang-min Liu", "data" : [ [ "Raku", @@ -207,11 +390,11 @@ "Blog", 1 ] - ], - "name" : "Kang-min Liu", - "id" : "Kang-min Liu" + ] }, { + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -225,13 +408,11 @@ "Blog", 1 ] - ], - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld" + ] }, { - "name" : "Lubos Kolouch", "id" : "Lubos Kolouch", + "name" : "Lubos Kolouch", "data" : [ [ "Perl", @@ -254,24 +435,24 @@ ] }, { + "name" : "Niels van Dijke", + "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ], - "name" : "Niels van Dijke", - "id" : "Niels van Dijke" + ] }, { - "name" : "Nuno Vieira", - "id" : "Nuno Vieira", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Nuno Vieira", + "name" : "Nuno Vieira" }, { "data" : [ @@ -280,22 +461,22 @@ 2 ] ], - "id" : "Paulo Custodio", - "name" : "Paulo Custodio" + "name" : "Paulo Custodio", + "id" : "Paulo Custodio" }, { - "id" : "Philip Hood", - "name" : "Philip Hood", "data" : [ [ "Raku", 1 ] - ] + ], + "id" : "Philip Hood", + "name" : "Philip Hood" }, { - "id" : "Roger Bell_West", "name" : "Roger Bell_West", + "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -312,6 +493,8 @@ ] }, { + "id" : "Simon Green", + "name" : "Simon Green", "data" : [ [ "Perl", @@ -321,33 +504,29 @@ "Blog", 1 ] - ], - "id" : "Simon Green", - "name" : "Simon Green" + ] }, { - "name" : "Simon Proctor", - "id" : "Simon Proctor", "data" : [ [ "Raku", 1 ] - ] + ], + "name" : "Simon Proctor", + "id" : "Simon Proctor" }, { - "name" : "Stuart Little", - "id" : "Stuart Little", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Stuart Little", + "id" : "Stuart Little" }, { - "id" : "Ulrich Rieke", - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -357,9 +536,13 @@ "Raku", 1 ] - ] + ], + "name" : "Ulrich Rieke", + "id" : "Ulrich Rieke" }, { + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -369,9 +552,7 @@ "Blog", 1 ] - ], - "id" : "W. Luis Mochan", - "name" : "W. Luis Mochan" + ] }, { "name" : "Wanderdoc", @@ -385,180 +566,22 @@ } ] }, + "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 + }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 } }, - "xAxis" : { - "type" : "category" - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "Aaron Smith", - "y" : 3, - "name" : "Aaron Smith" - }, - { - "drilldown" : "Abigail", - "name" : "Abigail", - "y" : 2 - }, - { - "y" : 4, - "name" : "Adam Russell", - "drilldown" : "Adam Russell" - }, - { - "drilldown" : "Arne Sommer", - "y" : 3, - "name" : "Arne Sommer" - }, - { - "drilldown" : "Athanasius", - "y" : 4, - "name" : "Athanasius" - }, - { - "drilldown" : "Cheok-Yin Fung", - "y" : 3, - "name" : "Cheok-Yin Fung" - }, - { - "drilldown" : "Dave Jacoby", - "name" : "Dave Jacoby", - "y" : 3 - }, - { - "drilldown" : "Duncan C. White", - "name" : "Duncan C. White", - "y" : 2 - }, - { - "drilldown" : "E. Choroba", - "y" : 2, - "name" : "E. Choroba" - }, - { - "drilldown" : "Flavio Poletti", - "y" : 4, - "name" : "Flavio Poletti" - }, - { - "drilldown" : "Gustavo Chaves", - "name" : "Gustavo Chaves", - "y" : 2 - }, - { - "drilldown" : "James Smith", - "y" : 3, - "name" : "James Smith" - }, - { - "drilldown" : "Jan Krnavek", - "y" : 2, - "name" : "Jan Krnavek" - }, - { - "drilldown" : "Joan Mimosinnet", - "y" : 2, - "name" : "Joan Mimosinnet" - }, - { - "name" : "Jorg Sommrey", - "y" : 2, - "drilldown" : "Jorg Sommrey" - }, - { - "drilldown" : "Kang-min Liu", - "name" : "Kang-min Liu", - "y" : 3 - }, - { - "y" : 5, - "name" : "Laurent Rosenfeld", - "drilldown" : "Laurent Rosenfeld" - }, - { - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch", - "y" : 2 - }, - { - "y" : 4, - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari" - }, - { - "drilldown" : "Niels van Dijke", - "y" : 2, - "name" : "Niels van Dijke" - }, - { - "drilldown" : "Nuno Vieira", - "y" : 2, - "name" : "Nuno Vieira" - }, - { - "name" : "Paulo Custodio", - "y" : 2, - "drilldown" : "Paulo Custodio" - }, - { - "y" : 1, - "name" : "Philip Hood", - "drilldown" : "Philip Hood" - }, - { - "drilldown" : "Roger Bell_West", - "y" : 5, - "name" : "Roger Bell_West" - }, - { - "y" : 3, - "name" : "Simon Green", - "drilldown" : "Simon Green" - }, - { - "y" : 1, - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor" - }, - { - "y" : 2, - "name" : "Stuart Little", - "drilldown" : "Stuart Little" - }, - { - "y" : 2, - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke" - }, - { - "name" : "W. Luis Mochan", - "y" : 3, - "drilldown" : "W. Luis Mochan" - }, - { - "drilldown" : "Wanderdoc", - "name" : "Wanderdoc", - "y" : 2 - } - ], - "name" : "Perl Weekly Challenge - 094", - "colorByPoint" : 1 - } - ], - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "legend" : { + "enabled" : 0 }, "title" : { "text" : "Perl Weekly Challenge - 094" diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index efcc4d1378..220ff4f6f9 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } + "xAxis" : { + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + }, + "type" : "category" + }, + "chart" : { + "type" : "column" + }, + "subtitle" : { + "text" : "Last updated at 2021-01-11 02:12:17 GMT" }, "series" : [ { - "dataLabels" : { - "color" : "#FFFFFF", - "y" : 10, - "rotation" : -90, - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "enabled" : "true", - "align" : "right", - "format" : "{point.y:.0f}" - }, "data" : [ [ "Blog", - 1244 + 1245 ], [ "Perl", - 4313 + 4314 ], [ "Raku", - 2844 + 2845 ] ], + "dataLabels" : { + "align" : "right", + "color" : "#FFFFFF", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "y" : 10, + "format" : "{point.y:.0f}", + "enabled" : "true", + "rotation" : -90 + }, "name" : "Contributions" } ], - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - } + "tooltip" : { + "pointFormat" : "<b>{point.y:.0f}</b>" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 }, "title" : { "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, - "chart" : { - "type" : "column" - }, "legend" : { "enabled" : "false" - }, - "subtitle" : { - "text" : "Last updated at 2021-01-10 21:31:15 GMT" - }, - "tooltip" : { - "pointFormat" : "<b>{point.y:.0f}</b>" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 5bb2306cb2..01db14feed 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,12 +1,7 @@ { - "title" : { - "text" : "Perl Weekly Challenge Language" - }, "drilldown" : { "series" : [ { - "id" : "001", - "name" : "001", "data" : [ [ "Perl", @@ -20,9 +15,13 @@ "Blog", 11 ] - ] + ], + "name" : "001", + "id" : "001" }, { + "id" : "002", + "name" : "002", "data" : [ [ "Perl", @@ -36,13 +35,11 @@ "Blog", 10 ] - ], - "id" : "002", - "name" : "002" + ] }, { - "id" : "003", "name" : "003", + "id" : "003", "data" : [ [ "Perl", @@ -59,8 +56,6 @@ ] }, { - "id" : "004", - "name" : "004", "data" : [ [ "Perl", @@ -74,7 +69,9 @@ "Blog", 10 ] - ] + ], + "id" : "004", + "name" : "004" }, { "data" : [ @@ -91,8 +88,8 @@ 12 ] ], - "name" : "005", - "id" : "005" + "id" : "005", + "name" : "005" }, { "data" : [ @@ -109,8 +106,8 @@ 7 ] ], - "id" : "006", - "name" : "006" + "name" : "006", + "id" : "006" }, { "data" : [ @@ -127,8 +124,8 @@ 10 ] ], - "id" : "007", - "name" : "007" + "name" : "007", + "id" : "007" }, { "name" : "008", @@ -149,6 +146,8 @@ ] }, { + "name" : "009", + "id" : "009", "data" : [ [ "Perl", @@ -162,11 +161,11 @@ "Blog", 13 ] - ], - "name" : "009", - "id" : "009" + ] }, { + "id" : "010", + "name" : "010", "data" : [ [ "Perl", @@ -180,9 +179,7 @@ "Blog", 11 |
