From 07916bcd6287f9df09e9ec08b67e88581dcd8dc5 Mon Sep 17 00:00:00 2001 From: Ryan Thompson Date: Mon, 13 Apr 2020 15:28:09 -0600 Subject: Task #1 solutions --- challenge-056/ryan-thompson/perl/ch-1.pl | 25 +++++++++++++++++++++++++ challenge-056/ryan-thompson/raku/ch-1.p6 | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 challenge-056/ryan-thompson/perl/ch-1.pl create mode 100644 challenge-056/ryan-thompson/raku/ch-1.p6 diff --git a/challenge-056/ryan-thompson/perl/ch-1.pl b/challenge-056/ryan-thompson/perl/ch-1.pl new file mode 100644 index 0000000000..3b87bdcd2f --- /dev/null +++ b/challenge-056/ryan-thompson/perl/ch-1.pl @@ -0,0 +1,25 @@ +#!/usr/bin/env perl +# +# ch-1.pl - Diff-K +# +# 2020 Ryan Thompson + +use 5.010; +use warnings; +use strict; + +# Diff-K +sub diff_k { + my $k = shift; + my %idx_of = map { $_[$_] => $_ } 0..$#_; + + map { [ @idx_of{ @$_ } ] } + grep { exists $idx_of{ $_->[0] } } + map { [ $k+$_, $_ ] } @_; +} + +my @list = qw< 0 2 3 5 6 7 9 10 11 14 15 16 17 18 19 21 22 + 25 28 29 31 32 33 34 35 37 38 40 41 44 46 47 48 49>; +say "@list"; + +say join ' ', map "[$_->[0], $_->[1]]", diff_k(30, @list); diff --git a/challenge-056/ryan-thompson/raku/ch-1.p6 b/challenge-056/ryan-thompson/raku/ch-1.p6 new file mode 100644 index 0000000000..d35ee5121a --- /dev/null +++ b/challenge-056/ryan-thompson/raku/ch-1.p6 @@ -0,0 +1,20 @@ +#!/usr/bin/env perl6 + +# ch-1.p6 - Diff-K +# +# Ryan Thompson + +# Diff-K +sub diff_k( $k, @N ) { + my %idx_of = @N.antipairs; + + @N.map( { $k+$_, $_ } ) + ==>grep( { %idx_of{$_[0]}:exists } ) + ==> map( { [ %idx_of{ |$_ } ] } ) +} + +my @list = < 0 2 3 5 6 7 9 10 11 14 15 16 17 18 19 21 22 + 25 28 29 31 32 33 34 35 37 38 40 41 44 46 47 48 49>; +say @list; + +say diff_k(30, @list); -- cgit From c8f327fe8006ea056ffa5f7f8d63fe32eb619fe1 Mon Sep 17 00:00:00 2001 From: saiftynet Date: Sun, 19 Apr 2020 15:46:56 +0100 Subject: Challenge-056 solutions by saiftynet --- challenge-056/saiftynet/perl/ch-1.pl | 32 ++++++ challenge-056/saiftynet/perl/ch-2.pl | 186 +++++++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 challenge-056/saiftynet/perl/ch-1.pl create mode 100644 challenge-056/saiftynet/perl/ch-2.pl diff --git a/challenge-056/saiftynet/perl/ch-1.pl b/challenge-056/saiftynet/perl/ch-1.pl new file mode 100644 index 0000000000..fea0c4674b --- /dev/null +++ b/challenge-056/saiftynet/perl/ch-1.pl @@ -0,0 +1,32 @@ +#!/usr/env/perl +# Task 1 Challenge 056 Solution by saiftynet +# Diff-K +# You are given an array @N of positive integers (sorted) and another +# non negative integer k. +# Write a script to find if there exists 2 indices i and j such +# that A[i] - A[j] = k and i != j. +# It should print the pairs of indices, if any such pairs exist. +# Example: +# @N = (2, 7, 9) $k = 2Output : 2,1 + + +# A rather simpler task than Task 2, most of the function +# definition is in the question + +use strict; use warnings; + +my @N = (2, 7, 9); # the tasks expects list to be sorted, handy. +my $k=2; + +diff_k($k,@N); + +sub diff_k{ + my ($k,@list)=@_; # list may be passed as a list or ArrayRef + @list=@{$list[0]}if (scalar @list==1); + for my $i(1..$#list){ # i is any number 1 to end index + for my $j (0..$i-1){ # j is smaller than i + print $i,",",$j,"\n" if ($list[$i]-$list[$j])==$k; + } + } +} + diff --git a/challenge-056/saiftynet/perl/ch-2.pl b/challenge-056/saiftynet/perl/ch-2.pl new file mode 100644 index 0000000000..ed08805ab8 --- /dev/null +++ b/challenge-056/saiftynet/perl/ch-2.pl @@ -0,0 +1,186 @@ +#!/usr/env/perl +# Task 2 Challenge 056 Solution by saiftynet +# Path Sum +# You are given a binary tree and a sum, write a script to find +# if the tree has a path such that adding up all the values along +# the path equals the given sum. Only complete paths (from root +# to leaf node) may be considered for a sum. +# Example +# Given the below binary tree and sum = 22, +# 5 +# / \ +# 4 8 +# / / \ +# 11 13 9 +# / \ \ +# 7 2 1 +# For the given binary tree,the partial path sum 5 → 8 → 9 = 22 is not valid. +# The script should return the path 5 → 4 → 11 → 2 whose sum is +# 22. + + +# I have no experience of using binary trees. +# There are implementations described in the Perl Cookbook +# There are variations also on MetaCPAN. +# Visualising such trees is also bit tricky (havent explored it fully) +# Having not the time to learn this, I have developed a much simpler +# simulated tree-like structure. The tree nodes are defined by +# a binary string starting with "1" (the root node),and the children +# of nodes are left or right by adding ones or zeros. so for a path that goes +# "left,left,right,left" would be described as "1101", and is the key +# in a hash containing a value at that node. This has several advantages, +# allowing quick and easy identification of parents, children, depth etc. +# and is probably more performant and space saving than other nested +# hashes or object orientated methods I have come across. +# The values at the nodes can be any scalar or reference. +# The display() routine traverses the tree displaying a reasonable +# representation ..(provided values are small) + +use strict;use warnings; + +my %binTree=(); # the hash containing the binary tree data + +# test(); # uncomment to test the implementation + +# The following four statements assembles the 9 node example tree +insertNode ("1"=>5); # 5 + # / \ +insertNode ("11"=>4, "10"=>8 ); # 4 8 + # / / \ +insertNode ("111"=>11,"101"=>13,"100"=>9 ); # 11 13 9 + # / \ \ +insertNode ("1111"=>7,"1110"=>2,"1000"=>1); # 7 2 1 + +# check that the correct tree has been drawn +drawTree(); + +print "The paths that add up to 22 are:-\n"; +# find all the leaves (nodes with no children) and do a pathSum +foreach (keys %binTree){ # examining each node + if (leafNode($_)){ # if its a leaf + my ($sum,@pathValues)=pathSum($_); # get the sum and path values + print join "──>",reverse @pathValues if $sum ==22; # draw path if $sum is target + } +} + +# insert into a node, prevent over-writes or orphans but allow duplicates +# multiple node string/value pairs can be supplied at the same time, +# allowing quick assembly of the tree +sub insertNode{ + my (@pairs)=@_; + while (@pairs>=2) { + my ($node,$value )=(shift @pairs, shift @pairs); + if (orphanNode($node) or defined $binTree{$node}){ + print "Can not insert into $node (is orphan or exists)\n"; + } + else { + $binTree{$node}=$value; + } + } +} + +# get the all the parent nodes and add their values, return both. +sub pathSum{ + my $node=shift; + my $sum=0; my @pathValues=(); + while ($node){ + push @pathValues,$binTree{$node}; + $sum+=$binTree{$node}; + chop $node; + } + return ($sum,@pathValues) +} + +# has no left or right children +sub leafNode{ + my $node=shift; + return not (defined $binTree{$node."0"} or defined $binTree{$node."1"} ); +} + +# has no parents but root is not an orphan +sub orphanNode{ + my $node=shift; + return (parentNode($node) or $node eq "1")?0:1 +} + +# get parent node (simply lop off end of node string) +sub parentNode{ + chop (my $node=shift); + return $node; +} + +# deletes a node and all its branches, deleting root node deletes all nodes +sub deleteNode{ + my $node=shift; + foreach (keys %binTree) + { delete $binTree{$_} if ($_=~/^$node/)} +} + +# this is an attempt to draw the tree...required for visual verification that +# the tree generated reflects what is required. the output is colourised +# to identify leaves, is drawn on its side to save space (left is down right is up) +# ASCII line symbols are used to draw branches +sub drawTree{ + our @downs=(); # collection of left branches + print "\n"; + nextNode("1"); # start with root node + print "\n"; + sub nextNode{ # call function that parses nodes + my $node=shift; + my $format=leafNode($node)?"──>\033[92;1m%2s\033[0m":"──>%2s"; + printf $format,$binTree{$node}; # color the leaves + # collect nodes with left branches + push @downs,$node."1" if (defined $binTree{$node."1"}); + if (defined $binTree{$node."0"}){ # go along right side if possible + nextNode($node."0") + } + else{ # otherwise go back up to the next node with left branch + return unless $node=pop @downs; # no more lefts...finish + my %vDashes; + $vDashes{ length $_ }=1 foreach (@downs); # vertical lines + print "\n"; + print " ",$vDashes{$_}?"│":" "foreach (2..(length $node)-1); + print " └"; # elbow + nextNode($node); + } + } +} + +# test function +sub test{ + print "Assembling random 'ordered tree' \n"; + byValue ("insert",int(100*rand()) ) foreach (0..30); # random number ordered insert + drawTree(); # draw tree + sleep 5; + + print "\033[2J\033[0;0H";#clear screen and jump to 0,0 + print "Deleting node '101' if it exists\n"; + deleteNode("101"); # delete node (and any children + drawTree(); + sleep 5; + print "\033[2J\033[0;0H";#clear screen and jump to 0,0 + print "Creating new node '101' and some non numeric children\n"; + insertNode("101","Hello","1010","there!","1011","It's","10110","me!",); + drawTree(); # draw tree + sleep 5; + deleteNode("1"); + print "\033[2J\033[0;0H";#clear screen and jump to 0,0 + # draw tree +} + +# this is the classic tree builder with values which are larger to left +# and smaller to the right. This function can be used to insert the data +# as well as search for values inthe tree. $action is either "insert" or "search" +sub byValue{ + my ($action,$value,$node,$side)=@_; + $node //= "1"; + my $found = 0; + while (defined $binTree{$node}){ + if ($binTree{$node}<$value) { $node=$node."1" } + elsif ($binTree{$node}>$value) { $node=$node."0" } + else {$found=1;last} + } + return $node if $action eq "search" and $found; + $binTree{$node}=$value; +} + -- cgit From 7c0d91eac24ee1f024fd63baa8d79f042621a7ee Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Sun, 19 Apr 2020 15:44:14 -0600 Subject: ch-2.p6 rewrite --- challenge-056/mark-anderson/raku/ch-2.p6 | 56 +++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/challenge-056/mark-anderson/raku/ch-2.p6 b/challenge-056/mark-anderson/raku/ch-2.p6 index 9020617df5..b0859436e2 100644 --- a/challenge-056/mark-anderson/raku/ch-2.p6 +++ b/challenge-056/mark-anderson/raku/ch-2.p6 @@ -1,19 +1,53 @@ #!/usr/bin/env raku -use Tree::DAG_Node:from; -my $lol = [ [ [ [7], [2], 11 ], 4 ], [ [13], [ [1], 9 ], 8 ], 5 ]; +class node { + has UInt $.value; + has node $.left is rw; + has node $.right is rw; + has node $.parent is rw; +} -my $tree = Tree::DAG_Node.lol_to_tree($lol); +sub traverse($node) { + if $node.left { + $node.left.parent = $node; + traverse($node.left); + } -$tree.walk_down({callback => &traverse}); + if $node.right { + $node.right.parent = $node; + traverse($node.right); + } -.say for $tree.draw_ascii_tree; + unless $node.left or $node.right { + sum_path($node); + } +} + +sub sum_path($node is copy) { + my @path; -sub traverse($node, $options) { - unless ($node.daughters) { - my @nodes = ($node.name, |(map { .name }, $node.ancestors)).reverse; - "@nodes.join(' + ') == 22".say if @nodes.sum == 22; + loop { + @path.push($node.value); + last unless $node.parent; + $node = $node.parent; } - - return 1; + + say @path.reverse.join(" -> ") ~ " == 22" if @path.sum == 22; } + +my $root = node.new(value => 5, parent => Nil); + +$root.left = node.new(value => 4); +$root.right = node.new(value => 8); + +$root.left.left = node.new(value => 11); + +$root.left.left.left = node.new(value => 7); +$root.left.left.right = node.new(value => 2); + +$root.right.left = node.new(value => 13); +$root.right.right = node.new(value => 9); + +$root.right.right.right = node.new(value => 1); + +traverse($root); -- cgit From 0645bf88ff68be3313279c443adac90005c487c9 Mon Sep 17 00:00:00 2001 From: Ryan Thompson Date: Sun, 19 Apr 2020 16:21:20 -0600 Subject: rjt's Week 056 solutions and blogs --- challenge-056/ryan-thompson/README.md | 17 ++++++++ challenge-056/ryan-thompson/blog.txt | 1 + challenge-056/ryan-thompson/blog1.txt | 1 + challenge-056/ryan-thompson/perl/ch-1.pl | 5 +-- challenge-056/ryan-thompson/perl/ch-2.pl | 68 ++++++++++++++++++++++++++++++++ challenge-056/ryan-thompson/raku/ch-1.p6 | 12 +++--- challenge-056/ryan-thompson/raku/ch-2.p6 | 23 +++++++++++ 7 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 challenge-056/ryan-thompson/blog.txt create mode 100644 challenge-056/ryan-thompson/blog1.txt create mode 100644 challenge-056/ryan-thompson/perl/ch-2.pl create mode 100644 challenge-056/ryan-thompson/raku/ch-2.p6 diff --git a/challenge-056/ryan-thompson/README.md b/challenge-056/ryan-thompson/README.md index 17a4aa11f8..698e3ee64f 100644 --- a/challenge-056/ryan-thompson/README.md +++ b/challenge-056/ryan-thompson/README.md @@ -1,2 +1,19 @@ # Ryan Thompson +## Week 056 Solutions + +### Task 1 › Diff-K + + * [Perl](perl/ch-1.pl) + * [Raku](raku/ch-1.p6) + +### Task 2 › Path Sum + + * [Perl](perl/ch-2.pl) + * [Raku](raku/ch-2.p6) + +## Blogs + + * [Diff-K](https://ry.ca/2020/04/diff-k/) + * [Path Sum](https://ry.ca/2020/04/path-sum/) + diff --git a/challenge-056/ryan-thompson/blog.txt b/challenge-056/ryan-thompson/blog.txt new file mode 100644 index 0000000000..4350797e84 --- /dev/null +++ b/challenge-056/ryan-thompson/blog.txt @@ -0,0 +1 @@ +https://ry.ca/2020/04/diff-k/ diff --git a/challenge-056/ryan-thompson/blog1.txt b/challenge-056/ryan-thompson/blog1.txt new file mode 100644 index 0000000000..7fb3850ad1 --- /dev/null +++ b/challenge-056/ryan-thompson/blog1.txt @@ -0,0 +1 @@ +https://ry.ca/2020/04/path-sum/ diff --git a/challenge-056/ryan-thompson/perl/ch-1.pl b/challenge-056/ryan-thompson/perl/ch-1.pl index 3b87bdcd2f..19855a5c39 100644 --- a/challenge-056/ryan-thompson/perl/ch-1.pl +++ b/challenge-056/ryan-thompson/perl/ch-1.pl @@ -13,9 +13,8 @@ sub diff_k { my $k = shift; my %idx_of = map { $_[$_] => $_ } 0..$#_; - map { [ @idx_of{ @$_ } ] } - grep { exists $idx_of{ $_->[0] } } - map { [ $k+$_, $_ ] } @_; + map { [ @idx_of{ $k+$_, $_ } ] } + grep { exists $idx_of{ $k+$_ } } @_; } my @list = qw< 0 2 3 5 6 7 9 10 11 14 15 16 17 18 19 21 22 diff --git a/challenge-056/ryan-thompson/perl/ch-2.pl b/challenge-056/ryan-thompson/perl/ch-2.pl new file mode 100644 index 0000000000..3d592b035d --- /dev/null +++ b/challenge-056/ryan-thompson/perl/ch-2.pl @@ -0,0 +1,68 @@ +#!/usr/bin/env perl +# +# ch-2.pl - Path Sum +# +# 2020 Ryan Thompson + +use 5.010; +use warnings; +use strict; +no warnings 'uninitialized'; + +my $tree = make_random_tree(degree => 3, height => 4); +print_tree($tree); + +my $sum = 30; +my @paths = path_sum($tree, $sum); + +say "\nResults:"; +if (@paths) { + say join(' + ', @$_) . " = $sum" for @paths; +} else { + say "No path found that equals $sum"; +} + +# Does a certain complete sum exist in the tree? +sub path_sum { + my ($tree, $sum_left, @path) = @_; + my ($val, @kids) = @$tree; + push @path, $val; + $sum_left -= $val; + return [@path] if $sum_left == 0 and !@kids; + return if $sum_left < 0; + + map { path_sum($_, $sum_left, @path) } @kids; +} + +# +# Helpers +# + +# Print a tree. Traverse from top. +sub print_tree { + my ($node, $depth) = @_; + my @node = @$node; + printf "%s%02d\n", '| ' x $depth, shift @node; + print_tree($_, $depth + 1) for @node; +} + +# Makes a random tree of specified degree and height +# degree: maximum number of nodes at each stage +# 2 +# 1 5 +# 3 6 7 +# +# [2, [1, [3]], [5, [6], [7]]] +sub make_random_tree { + my %a = ( + degree => 2, + height => 5, + prune => sub { my %a = @_; 1 + rand $a{height}**5.2 < $a{depth}**5 }, + range => 20, + @_ + ); + + return if $a{depth}++ == $a{height} or $a{prune}(%a); + + [ int rand $a{range} => map { make_random_tree(%a) } 1..$a{degree} ]; +} diff --git a/challenge-056/ryan-thompson/raku/ch-1.p6 b/challenge-056/ryan-thompson/raku/ch-1.p6 index d35ee5121a..cb0fb40a8f 100644 --- a/challenge-056/ryan-thompson/raku/ch-1.p6 +++ b/challenge-056/ryan-thompson/raku/ch-1.p6 @@ -4,17 +4,15 @@ # # Ryan Thompson -# Diff-K +#| Diff-K in O(n) time sub diff_k( $k, @N ) { my %idx_of = @N.antipairs; - @N.map( { $k+$_, $_ } ) - ==>grep( { %idx_of{$_[0]}:exists } ) - ==> map( { [ %idx_of{ |$_ } ] } ) + @N.grep( { %idx_of{ $k+$_ }:exists } ) + ==> map( { [ %idx_of{ $k+$_,$_ } ] } ) } -my @list = < 0 2 3 5 6 7 9 10 11 14 15 16 17 18 19 21 22 - 25 28 29 31 32 33 34 35 37 38 40 41 44 46 47 48 49>; -say @list; +say my @list = < 0 2 3 5 6 7 9 10 11 14 15 16 17 18 19 21 22 + 25 28 29 31 32 33 34 35 37 38 40 41 44 46 47 48 49>; say diff_k(30, @list); diff --git a/challenge-056/ryan-thompson/raku/ch-2.p6 b/challenge-056/ryan-thompson/raku/ch-2.p6 new file mode 100644 index 0000000000..5ed98c6ea3 --- /dev/null +++ b/challenge-056/ryan-thompson/raku/ch-2.p6 @@ -0,0 +1,23 @@ +#!/usr/bin/env perl6 + +# ch-2.p6 - Path Sum +# +# Ryan Thompson + +#@tree = [10, [18, [5], [2]], [8, [16, [18]], [9]]]; + +my @tree = [6, [5, [2], [4, [15]]], [19, [4, [5]], [2, [12]]], [1, [16, [7]]]]; + +path-sum(@tree,30).say; + +#| Does a certain complete sum exist in the tree? +sub path-sum( @tree, $sum is copy, @path is copy = [] ) { + my ($val, @kids) = @tree; + @path.push: $val; + $sum -= $val; + + return @path if $sum == 0 and !@kids; + return Empty if $sum < 0; + + |@kids.map: { path-sum($_, $sum, @path) }; +} -- cgit From 9ca7ce91e1f59882e4e5a18d42679c501eee176d Mon Sep 17 00:00:00 2001 From: Jared Martin Date: Sun, 19 Apr 2020 17:26:33 -0500 Subject: Add in suggestion from Mohammad S Anwar --- challenge-056/jaredor/perl/ch-1.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/challenge-056/jaredor/perl/ch-1.pl b/challenge-056/jaredor/perl/ch-1.pl index 64e81a8c49..e39cceb1fb 100755 --- a/challenge-056/jaredor/perl/ch-1.pl +++ b/challenge-056/jaredor/perl/ch-1.pl @@ -14,6 +14,7 @@ GetOptions( 'k=i' => \$difference ) or die "Problem with GetOptions."; # "non negative integer k" +die "The --k option must be used to set the difference." unless defined $difference; die "The --k option must be non-negative: $difference" unless $difference >= 0; # "array @N of positive integers (sorted)" -- cgit From 7ea60585f695519c72b4c89d3634c7feab5cbef0 Mon Sep 17 00:00:00 2001 From: Adam Russell Date: Sun, 19 Apr 2020 18:31:53 -0400 Subject: solution for challenge-056 --- challenge-056/adam-russell/blog.txt | 1 + challenge-056/adam-russell/ch-2.dot | 25 +++++++ challenge-056/adam-russell/ch-2.png | Bin 0 -> 12789 bytes challenge-056/adam-russell/perl/ch-1.pl | 30 +++++++++ challenge-056/adam-russell/perl/ch-2.pl | 114 ++++++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+) create mode 100644 challenge-056/adam-russell/blog.txt create mode 100644 challenge-056/adam-russell/ch-2.dot create mode 100644 challenge-056/adam-russell/ch-2.png create mode 100644 challenge-056/adam-russell/perl/ch-1.pl create mode 100644 challenge-056/adam-russell/perl/ch-2.pl diff --git a/challenge-056/adam-russell/blog.txt b/challenge-056/adam-russell/blog.txt new file mode 100644 index 0000000000..4f188236d7 --- /dev/null +++ b/challenge-056/adam-russell/blog.txt @@ -0,0 +1 @@ +https://adamcrussell.livejournal.com/15709.html diff --git a/challenge-056/adam-russell/ch-2.dot b/challenge-056/adam-russell/ch-2.dot new file mode 100644 index 0000000000..e4f9e91e48 --- /dev/null +++ b/challenge-056/adam-russell/ch-2.dot @@ -0,0 +1,25 @@ +digraph GRAPH_0 { + + // Generated by Graph::Easy 0.76 at Sun Apr 19 18:11:09 2020 + + edge [ arrowhead=open ]; + graph [ rankdir=LR ]; + node [ + fillcolor=white, + fontsize=11, + shape=box, + style=filled ]; + + "11*" -> "6*" [ color="#000000:#000000" ] + "11*" -> 19 [ color="#000000:#000000" ] + 19 -> 43 [ color="#000000:#000000" ] + 19 -> 17 [ color="#000000:#000000" ] + "6*" -> 4 [ color="#000000:#000000" ] + "6*" -> "8*" [ color="#000000:#000000" ] + 43 -> 49 [ color="#000000:#000000" ] + 43 -> 31 [ color="#000000:#000000" ] + 4 -> 5 [ color="#000000:#000000" ] + "8*" -> "10*" [ color="#000000:#000000" ] + +} + diff --git a/challenge-056/adam-russell/ch-2.png b/challenge-056/adam-russell/ch-2.png new file mode 100644 index 0000000000..bc5dfddea4 Binary files /dev/null and b/challenge-056/adam-russell/ch-2.png differ diff --git a/challenge-056/adam-russell/perl/ch-1.pl b/challenge-056/adam-russell/perl/ch-1.pl new file mode 100644 index 0000000000..972c64a8d5 --- /dev/null +++ b/challenge-056/adam-russell/perl/ch-1.pl @@ -0,0 +1,30 @@ +use strict; +use warnings; +## +# You are given an array @N of positive +# integers (sorted) and another non negative integer k. +# Write a script to find if there exists two indices +# i and j such that A[i] - A[j] = k and i != j. +# Print the pairs of indices, if any such pairs exist. +my @N = (2, 7, 9); +my $k = 2; +my @pairs; +for my $i (0 .. @N - 1){ + for my $j (0 .. @N - 1){ + push @pairs, [$i, $j] if($N[$i] - $N[$j] == $k && $i != $j); + } +} +if(!@pairs){ + print "No matching pairs\n"; +} +elsif(@pairs == 1){ + print "Matching Pair: "; + print "(" . join(",", @{$pairs[0]}) . ")\n"; +} +else{ + print "Matching Pairs: "; + for my $i (0 .. @pairs - 2){ + print "(" . join(",", @{$pairs[$i]}) . "), "; + } + print "(" . join(",", @{$pairs[@pairs - 1]}) . ")\n"; +} diff --git a/challenge-056/adam-russell/perl/ch-2.pl b/challenge-056/adam-russell/perl/ch-2.pl new file mode 100644 index 0000000000..f0d116921d --- /dev/null +++ b/challenge-056/adam-russell/perl/ch-2.pl @@ -0,0 +1,114 @@ +use strict; +use warnings; +## +# You are given a binary tree and a sum, write +# a script to find if the tree has a path such +# that adding up all the values along the path +# Only complete paths (from root to leaf node) +# may be considered for a sum. +## +use Graph; +use boolean; +use Graph::Easy::Parser; + +use constant SUM => 35; + +sub insert{ + my($graph, $root, $next) = @_; + if(!$graph->vertices()){ + $graph->add_vertex($next); + $graph->set_edge_attribute($next, "left", "left", true); + $graph->set_edge_attribute($next, "right", "right", true); + return $next; + } + if($root > $next){ + if($graph->has_edge_attribute($root, "left", "left")){ + $graph->delete_edge_attributes($root, "left"); + $graph->set_edge_attribute($root, $next, "left", true); + $graph->set_edge_attribute($next, "left", "left", true); + $graph->set_edge_attribute($next, "right", "right", true); + } + my @successors = $graph->successors($root); + for my $s (@successors){ + if($graph->has_edge_attribute($root, $s, "left")){ + insert($graph, $s, $next); + } + } + } + if($root < $next){ + if($graph->has_edge_attribute($root, "right", "right")){ + $graph->delete_edge_attributes($root, "right"); + $graph->set_edge_attribute($root, $next, "right", true); + $graph->set_edge_attribute($next, "left", "left", true); + $graph->set_edge_attribute($next, "right", "right", true); + } + my @successors = $graph->successors($root); + for my $s (@successors){ + if($graph->has_edge_attribute($root, $s, "right")){ + insert($graph, $s, $next); + } + } + } +} + +sub find_path_sum{ + my($graph, $sum, $path) = @_; + my $parent = $path->[-1]; + my @children = $graph->successors($parent); + for my $v (@children){ + push @{$path}, $v; + my $total = unpack("%32C*", pack("C*", @{$path})); + if($total == $sum && $graph->is_sink_vertex($v)){ + return $path; + } + else{ + my @p = @{$path}; + $path = find_path_sum($graph, $sum, \@p) if @p; + if($path){ + my $total = unpack("%32C*", pack("C*", @{$path})); + return $path if $total == $sum; + } + } + } +} + +sub display_path{ + my($graph, $path) = @_; + my $s = $graph->stringify(); + for my $v (@{$path}){ + my $v_ = "$v*"; + $s =~ s/$v/$v_/g; + } + my @s = split(/,/, $s); + my @lines; + for my $n (@s){ + my @a = split(/-/, $n); + push @lines, "[ $a[0] ] => [ $a[1] ]"; + } + my $parser = new Graph::Easy::Parser(); + my $graph_viz = $parser->from_text(join("", @lines)); + print $graph_viz->as_ascii(); + #print $graph_viz->as_graphviz(); +} + +MAIN:{ + my $graph = new Graph(multivertexed => true); + my @a = (11, 6, 8, 19, 4, 10, 5, 17, 43, 49, 31); + my $root; + for my $a (@a){ + if(!$root){ + $root = insert($graph, $root, $a) + } + else{ + insert($graph, $root, $a) + } + } + while($graph->has_vertex("left") && $graph->has_vertex("right")){ + $graph->delete_vertices("left", "right"); + } + my $path = find_path_sum($graph, SUM, [$root]); + display_path($graph, $path); +} + +__END__ +11*-19,11-6*,19-17,19-43,4-5,43-31,43-49,6-4,6-8*,8-10* -- cgit From 60a76ae70bf815bb359bee61efd79a895a55d111 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 20 Apr 2020 00:00:50 +0100 Subject: - Tided up Raku unit test solution. --- challenge-056/mohammad-anwar/raku/ch-2a.p6 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/challenge-056/mohammad-anwar/raku/ch-2a.p6 b/challenge-056/mohammad-anwar/raku/ch-2a.p6 index 8608fcb538..0a5b418234 100644 --- a/challenge-056/mohammad-anwar/raku/ch-2a.p6 +++ b/challenge-056/mohammad-anwar/raku/ch-2a.p6 @@ -18,6 +18,8 @@ for $unit-tests.keys -> $SUM { is-deeply(find-matched-paths($TREE, $SUM), $OUT, "Tree with sum $SUM"); } +done-testing; + sub find-matched-paths(Hash[] $TREE, Int $SUM) { my $paths = []; -- cgit From 83e82da6918a7890b8f5868c97f6d017cf4a1161 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 20 Apr 2020 00:24:28 +0100 Subject: - Added solutions by Ryan Thompson. --- stats/pwc-current.json | 243 +++++---- stats/pwc-language-breakdown-summary.json | 66 +-- stats/pwc-language-breakdown.json | 846 +++++++++++++++--------------- stats/pwc-leaders.json | 770 +++++++++++++-------------- stats/pwc-summary-1-30.json | 94 ++-- stats/pwc-summary-121-150.json | 96 ++-- stats/pwc-summary-151-180.json | 78 +-- stats/pwc-summary-31-60.json | 110 ++-- stats/pwc-summary-61-90.json | 32 +- stats/pwc-summary-91-120.json | 32 +- stats/pwc-summary.json | 36 +- 11 files changed, 1213 insertions(+), 1190 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 9ecaf69e01..6ae8d5c72b 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,20 +1,46 @@ { "tooltip" : { - "followPointer" : 1, + "pointFormat" : "{point.name}: {point.y:f}
", "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
" + "followPointer" : 1 + }, + "legend" : { + "enabled" : 0 + }, + "title" : { + "text" : "Perl Weekly Challenge - 056" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "subtitle" : { + "text" : "[Champions: 29] Last updated at 2020-04-19 23:23:38 GMT" }, "series" : [ { "data" : [ { "y" : 2, - "drilldown" : "Alicia Bielsa", - "name" : "Alicia Bielsa" + "name" : "Alicia Bielsa", + "drilldown" : "Alicia Bielsa" }, { - "y" : 2, "drilldown" : "Andrezgz", + "y" : 2, "name" : "Andrezgz" }, { @@ -24,18 +50,18 @@ }, { "name" : "Athanasius", - "drilldown" : "Athanasius", - "y" : 3 + "y" : 3, + "drilldown" : "Athanasius" }, { "name" : "Cheok-Yin Fung", - "drilldown" : "Cheok-Yin Fung", - "y" : 1 + "y" : 1, + "drilldown" : "Cheok-Yin Fung" }, { - "y" : 4, "drilldown" : "Colin Crain", - "name" : "Colin Crain" + "name" : "Colin Crain", + "y" : 4 }, { "y" : 1, @@ -43,8 +69,8 @@ "drilldown" : "Cristina Heredia" }, { - "y" : 3, "name" : "Dave Jacoby", + "y" : 3, "drilldown" : "Dave Jacoby" }, { @@ -53,9 +79,9 @@ "drilldown" : "Duncan C. White" }, { - "y" : 2, + "drilldown" : "E. Choroba", "name" : "E. Choroba", - "drilldown" : "E. Choroba" + "y" : 2 }, { "y" : 3, @@ -63,8 +89,8 @@ "drilldown" : "Jared Martin" }, { - "name" : "Javier Luque", "drilldown" : "Javier Luque", + "name" : "Javier Luque", "y" : 5 }, { @@ -73,69 +99,74 @@ "drilldown" : "Kevin Colyer" }, { - "y" : 5, + "drilldown" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", - "drilldown" : "Laurent Rosenfeld" + "y" : 5 }, { + "drilldown" : "Leo Manfredi", "y" : 1, - "name" : "Leo Manfredi", - "drilldown" : "Leo Manfredi" + "name" : "Leo Manfredi" }, { - "y" : 2, + "drilldown" : "Lubos Kolouch", "name" : "Lubos Kolouch", - "drilldown" : "Lubos Kolouch" + "y" : 2 }, { - "y" : 4, "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari" + "name" : "Luca Ferrari", + "y" : 4 }, { - "name" : "Mark Anderson", "drilldown" : "Mark Anderson", + "name" : "Mark Anderson", "y" : 4 }, { - "y" : 2, + "drilldown" : "Markus Holzer", "name" : "Markus Holzer", - "drilldown" : "Markus Holzer" + "y" : 2 }, { + "drilldown" : "Matthew Somerville", "y" : 3, - "name" : "Matthew Somerville", - "drilldown" : "Matthew Somerville" + "name" : "Matthew Somerville" }, { - "y" : 4, + "drilldown" : "Mohammad S Anwar", "name" : "Mohammad S Anwar", - "drilldown" : "Mohammad S Anwar" + "y" : 4 }, { "name" : "Noud Aldenhoven", - "drilldown" : "Noud Aldenhoven", - "y" : 2 + "y" : 2, + "drilldown" : "Noud Aldenhoven" }, { + "y" : 3, "name" : "Roger Bell West", - "drilldown" : "Roger Bell West", - "y" : 3 + "drilldown" : "Roger Bell West" + }, + { + "drilldown" : "Ryan Thompson", + "y" : 6, + "name" : "Ryan Thompson" }, { - "drilldown" : "Shahed Nooshmand", + "y" : 3, "name" : "Shahed Nooshmand", - "y" : 3 + "drilldown" : "Shahed Nooshmand" }, { + "y" : 2, "name" : "Simon Proctor", - "drilldown" : "Simon Proctor", - "y" : 2 + "drilldown" : "Simon Proctor" }, { + "y" : 2, "name" : "User Person", - "drilldown" : "User Person", - "y" : 2 + "drilldown" : "User Person" }, { "y" : 2, @@ -144,37 +175,14 @@ }, { "drilldown" : "Yet Ebreo", - "name" : "Yet Ebreo", - "y" : 2 + "y" : 2, + "name" : "Yet Ebreo" } ], - "name" : "Perl Weekly Challenge - 056", - "colorByPoint" : 1 + "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 056" } ], - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "xAxis" : { - "type" : "category" - }, - "title" : { - "text" : "Perl Weekly Challenge - 056" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } - }, - "legend" : { - "enabled" : 0 - }, "drilldown" : { "series" : [ { @@ -188,17 +196,16 @@ "name" : "Alicia Bielsa" }, { - "name" : "Andrezgz", "id" : "Andrezgz", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Andrezgz" }, { - "name" : "Arne Sommer", "id" : "Arne Sommer", "data" : [ [ @@ -209,11 +216,12 @@ "Blog", 1 ] - ] + ], + "name" : "Arne Sommer" }, { - "id" : "Athanasius", "name" : "Athanasius", + "id" : "Athanasius", "data" : [ [ "Perl", @@ -226,13 +234,13 @@ ] }, { + "name" : "Cheok-Yin Fung", "data" : [ [ "Perl", 1 ] ], - "name" : "Cheok-Yin Fung", "id" : "Cheok-Yin Fung" }, { @@ -260,6 +268,8 @@ ] }, { + "name" : "Dave Jacoby", + "id" : "Dave Jacoby", "data" : [ [ "Perl", @@ -269,13 +279,11 @@ "Blog", 1 ] - ], - "id" : "Dave Jacoby", - "name" : "Dave Jacoby" + ] }, { - "id" : "Duncan C. White", "name" : "Duncan C. White", + "id" : "Duncan C. White", "data" : [ [ "Perl", @@ -290,10 +298,12 @@ 2 ] ], - "name" : "E. Choroba", - "id" : "E. Choroba" + "id" : "E. Choroba", + "name" : "E. Choroba" }, { + "name" : "Jared Martin", + "id" : "Jared Martin", "data" : [ [ "Perl", @@ -303,9 +313,7 @@ "Blog", 1 ] - ], - "id" : "Jared Martin", - "name" : "Jared Martin" + ] }, { "name" : "Javier Luque", @@ -336,6 +344,7 @@ ] }, { + "id" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -350,32 +359,31 @@ 1 ] ], - "id" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld" }, { + "name" : "Leo Manfredi", + "id" : "Leo Manfredi", "data" : [ [ "Perl", 1 ] - ], - "id" : "Leo Manfredi", - "name" : "Leo Manfredi" + ] }, { - "name" : "Lubos Kolouch", "id" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Lubos Kolouch" }, { - "id" : "Luca Ferrari", "name" : "Luca Ferrari", + "id" : "Luca Ferrari", "data" : [ [ "Raku", @@ -388,8 +396,8 @@ ] }, { - "id" : "Mark Anderson", "name" : "Mark Anderson", + "id" : "Mark Anderson", "data" : [ [ "Perl", @@ -402,8 +410,8 @@ ] }, { - "id" : "Markus Holzer", "name" : "Markus Holzer", + "id" : "Markus Holzer", "data" : [ [ "Raku", @@ -412,6 +420,7 @@ ] }, { + "id" : "Matthew Somerville", "data" : [ [ "Perl", @@ -422,12 +431,9 @@ 1 ] ], - "name" : "Matthew Somerville", - "id" : "Matthew Somerville" + "name" : "Matthew Somerville" }, { - "id" : "Mohammad S Anwar", - "name" : "Mohammad S Anwar", "data" : [ [ "Perl", @@ -437,21 +443,22 @@ "Raku", 2 ] - ] + ], + "id" : "Mohammad S Anwar", + "name" : "Mohammad S Anwar" }, { - "id" : "Noud Aldenhoven", - "name" : "Noud Aldenhoven", "data" : [ [ "Raku", 2 ] - ] + ], + "id" : "Noud Aldenhoven", + "name" : "Noud Aldenhoven" }, { "id" : "Roger Bell West", - "name" : "Roger Bell West", "data" : [ [ "Perl", @@ -461,30 +468,49 @@ "Raku", 1 ] - ] + ], + "name" : "Roger Bell West" }, { "data" : [ + [ + "Perl", + 2 + ], [ "Raku", 2 ], [ "Blog", - 1 + 2 ] ], + "id" : "Ryan Thompson", + "name" : "Ryan Thompson" + }, + { + "name" : "Shahed Nooshmand", "id" : "Shahed Nooshmand", - "name" : "Shahed Nooshmand" + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] }, { + "name" : "Simon Proctor", "data" : [ [ "Raku", 2 ] ], - "name" : "Simon Proctor", "id" : "Simon Proctor" }, { @@ -498,31 +524,28 @@ "name" : "User Person" }, { + "id" : "Wanderdoc", "data" : [ [ "Perl", 2 ] ], - "id" : "Wanderdoc", "name" : "Wanderdoc" }, { "name" : "Yet Ebreo", - "id" : "Yet Ebreo", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Yet Ebreo" } ] }, "chart" : { "type" : "column" - }, - "subtitle" : { - "text" : "[Champions: 28] Last updated at 2020-04-19 21:30:01 GMT" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index dfa9c4ac89..3148a2ab1c 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { - "subtitle" : { - "text" : "Last updated at 2020-04-19 21:30:01 GMT" - }, - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : "false" - }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" - }, - "xAxis" : { - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - }, - "type" : "category" - }, "yAxis" : { "title" : { "text" : null }, "min" : 0 }, + "subtitle" : { + "text" : "Last updated at 2020-04-19 23:23:38 GMT" + }, "series" : [ { + "name" : "Contributions", "dataLabels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, + "rotation" : -90, "enabled" : "true", - "format" : "{point.y:.0f}", "color" : "#FFFFFF", - "align" : "right", + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, "y" : 10, - "rotation" : -90 + "align" : "right", + "format" : "{point.y:.0f}" }, "data" : [ [ "Blog", - 622 + 624 ], [ "Perl", - 2380 + 2382 ], [ "Raku", - 1490 + 1492 ] - ], - "name" : "Contributions" + ] } ], + "xAxis" : { + "type" : "category", + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + } + }, + "chart" : { + "type" : "column" + }, + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + }, "tooltip" : { "pointFormat" : "{point.y:.0f}" + }, + "legend" : { + "enabled" : "false" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 3588ab5f4c..9791aa73e3 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,9 +1,14 @@ { - "chart" : { - "type" : "column" + "tooltip" : { + "pointFormat" : "Challenge {point.name}: {point.y:f}
", + "headerFormat" : "", + "followPointer" : "true" }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-04-19 21:30:01 GMT" + "legend" : { + "enabled" : "false" + }, + "title" : { + "text" : "Perl Weekly Challenge Language" }, "plotOptions" : { "series" : { @@ -14,15 +19,310 @@ } } }, - "title" : { - "text" : "Perl Weekly Challenge Language" + "xAxis" : { + "type" : "category" }, - "legend" : { - "enabled" : "false" + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "series" : [ + { + "colorByPoint" : "true", + "name" : "Perl Weekly Challenge Languages", + "data" : [ + { + "drilldown" : "001", + "name" : "#001", + "y" : 140 + }, + { + "drilldown" : "002", + "name" : "#002", + "y" : 109 + }, + { + "drilldown" : "003", + "name" : "#003", + "y" : 71 + }, + { + "drilldown" : "004", + "name" : "#004", + "y" : 91 + }, + { + "name" : "#005", + "y" : 71, + "drilldown" : "005" + }, + { + "y" : 52, + "name" : "#006", + "drilldown" : "006" + }, + { + "name" : "#007", + "y" : 58, + "drilldown" : "007" + }, + { + "name" : "#008", + "y" : 70, + "drilldown" : "008" + }, + { + "y" : 68, + "name" : "#009", + "drilldown" : "009" + }, + { + "y" : 60, + "name" : "#010", + "drilldown" : "010" + }, + { + "drilldown" : "011", + "name" : "#011", + "y" : 79 + }, + { + "drilldown" : "012", + "y" : 83, + "name" : "#012" + }, + { + "y" : 76, + "name" : "#013", + "drilldown" : "013" + }, + { + "drilldown" : "014", + "name" : "#014", + "y" : 96 + }, + { + "y" : 93, + "name" : "#015", + "drilldown" : "015" + }, + { + "drilldown" : "016", + "name" : "#016", + "y" : 66 + }, + { + "drilldown" : "017", + "name" : "#017", + "y" : 79 + }, + { + "name" : "#018", + "y" : 76, + "drilldown" : "018" + }, + { + "drilldown" : "019", + "name" : "#019", + "y" : 97 + }, + { + "drilldown" : "020", + "name" : "#020", + "y" : 95 + }, + { + "drilldown" : "021", + "name" : "#021", + "y" : 67 + }, + { + "drilldown" : "022", + "name" : "#022", + "y" : 63 + }, + { + "drilldown" : "023", + "y" : 91, + "name" : "#023" + }, + { + "drilldown" : "024", + "name" : "#024", + "y" : 70 + }, + { + "y" : 55, + "name" : "#025", + "drilldown" : "025" + }, + { + "drilldown" : "026", + "name" : "#026", + "y" : 70 + }, + { + "y" : 58, + "name" : "#027", + "drilldown" : "027" + }, + { + "drilldown" : "028", + "y" : 78, + "name" : "#028" + }, + { + "drilldown" : "029", + "name" : "#029", + "y" : 77 + }, + { + "y" : 115, + "name" : "#030", + "drilldown" : "030" + }, + { + "drilldown" : "031", + "y" : 87, + "name" : "#031" + }, + { + "name" : "#032", + "y" : 92, + "drilldown" : "032" + }, + { + "drilldown" : "033", + "y" : 108, + "name" : "#033" + }, + { + "name" : "#034", + "y" : 62, + "drilldown" : "034" + }, + { + "drilldown" : "035", + "y" : 62, + "name" : "#035" + }, + { + "drilldown" : "036", + "name" : "#036", + "y" : 66 + }, + { + "y" : 63, + "name" : "#037", + "drilldown" : "037" + }, + { + "y" : 65, + "name" : "#038", + "drilldown" : "038" + }, + { + "name" : "#039", + "y" : 60, + "drilldown" : "039" + }, + { + "drilldown" : "040", + "name" : "#040", + "y" : 71 + }, + { + "drilldown" : "041", + "name" : "#041", + "y" : 74 + }, + { + "y" : 88, + "name" : "#042", + "drilldown" : "042" + }, + { + "drilldown" : "043", + "y" : 65, + "name" : "#043" + }, + { + "name" : "#044", + "y" : 81, + "drilldown" : "044" + }, + { + "drilldown" : "045", + "y" : 94, + "name" : "#045" + }, + { + "y" : 83, + "name" : "#046", + "drilldown" : "046" + }, + { + "name" : "#047", + "y" : 81, + "drilldown" : "047" + }, + { + "y" : 106, + "name" : "#048", + "drilldown" : "048" + }, + { + "drilldown" : "049", + "y" : 85, + "name" : "#049" + }, + { + "y" : 96, + "name" : "#050", + "drilldown" : "050" + }, + { + "y" : 87, + "name" : "#051", + "drilldown" : "051" + }, + { + "drilldown" : "052", + "y" : 89, + "name" : "#052" + }, + { + "name" : "#053", + "y" : 99, + "drilldown" : "053" + }, + { + "y" : 95, + "name" : "#054", + "drilldown" : "054" + }, + { + "name" : "#055", + "y" : 85, + "drilldown" : "055" + }, + { + "drilldown" : "056", + "y" : 80, + "name" : "#056" + } + ] + } + ], + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-04-19 23:23:38 GMT" }, "drilldown" : { "series" : [ { + "name" : "001", + "id" : "001", "data" : [ [ "Perl", @@ -36,11 +336,10 @@ "Blog", 11 ] - ], - "name" : "001", - "id" : "001" + ] }, { + "id" : "002", "data" : [ [ "Perl", @@ -55,12 +354,11 @@ 10 ] ], - "name" : "002", - "id" : "002" + "name" : "002" }, { - "id" : "003", "name" : "003", + "id" : "003", "data" : [ [ "Perl", @@ -77,6 +375,7 @@ ] }, { + "name" : "004", "data" : [ [ "Perl", @@ -91,10 +390,11 @@ 10 ] ], - "name" : "004", "id" : "004" }, { + "name" : "005", + "id" : "005", "data" : [ [ "Perl", @@ -108,11 +408,10 @@ "Blog", 12 ] - ], - "id" : "005", - "name" : "005" + ] }, { + "name" : "006", "data" : [ [ "Perl", @@ -127,8 +426,7 @@ 7 ] ], - "id" : "006", - "name" : "006" + "id" : "006" }, { "name" : "007", @@ -149,6 +447,7 @@ ] }, { + "id" : "008", "data" : [ [ "Perl", @@ -163,10 +462,11 @@ 12 ] ], - "id" : "008", "name" : "008" }, { + "name" : "009", + "id" : "009", "data" : [ [ "Perl", @@ -180,12 +480,9 @@ "Blog", 13 ] - ], - "id" : "009", - "name" : "009" + ] }, { - "name" : "010", "id" : "010", "data" : [ [ @@ -200,10 +497,10 @@ "Blog", 11 ] - ] + ], + "name" : "010" }, { - "name" : "011", "id" : "011", "data" : [ [ @@ -218,11 +515,12 @@ "Blog", 10 ] - ] + ], + "name" : "011" }, { - "id" : "012", "name" : "012", + "id" : "012", "data" : [ [ "Perl", @@ -257,6 +555,7 @@ ] }, { + "name" : "014", "data" : [ [ "Perl", @@ -271,10 +570,10 @@ 15 ] ], - "id" : "014", - "name" : "014" + "id" : "014" }, { + "id" : "015", "data" : [ [ "Perl", @@ -289,10 +588,11 @@ 15 ] ], - "name" : "015", - "id" : "015" + "name" : "015" }, { + "name" : "016", + "id" : "016", "data" : [ [ "Perl", @@ -306,11 +606,11 @@ "Blog", 12 ] - ], - "name" : "016", - "id" : "016" + ] }, { + "name" : "017", + "id" : "017", "data" : [ [ "Perl", @@ -324,12 +624,9 @@ "Blog", 12 ] - ], - "id" : "017", - "name" : "017" + ] }, { - "name" : "018", "id" : "018", "data" : [ [ @@ -344,11 +641,11 @@ "Blog", 14 ] - ] + ], + "name" : "018" }, { "id" : "019", - "name" : "019", "data" : [ [ "Perl", @@ -362,10 +659,10 @@ "Blog", 13 ] - ] + ], + "name" : "019" }, { - "id" : "020", "name" : "020", "data" : [ [ @@ -380,11 +677,12 @@ "Blog", 13 ] - ] + ], + "id" : "020" }, { - "id" : "021", "name" : "021", + "id" : "021", "data" : [ [ "Perl", @@ -401,7 +699,6 @@ ] }, { - "name" : "022", "id" : "022", "data" : [ [ @@ -416,10 +713,10 @@ "Blog", 10 ] - ] + ], + "name" : "022" }, { - "id" : "023", "name" : "023", "data" : [ [ @@ -434,11 +731,10 @@ "Blog", 12 ] - ] + ], + "id" : "023" }, { - "id" : "024", - "name" : "024", "data" : [ [ "Perl", @@ -452,7 +748,9 @@ "Blog", 11 ] - ] + ], + "id" : "024", + "name" : "024" }, { "data" : [ @@ -469,12 +767,11 @@ 12 ] ], - "name" : "025", - "id" : "025" + "id" : "025", + "name" : "025" }, { "id" : "026", - "name" : "026", "data" : [ [ "Perl", @@ -488,9 +785,11 @@ "Blog", 10 ] - ] + ], + "name" : "026" }, { + "id" : "027", "data" : [ [ "Perl", @@ -505,12 +804,9 @@ 9 ] ], - "name" : "027", - "id" : "027" + "name" : "027" }, { - "name" : "028", - "id" : "028", "data" : [ [ "Perl", @@ -524,11 +820,13 @@ "Blog", 9 ] - ] + ], + "id" : "028", + "name" : "028" }, { - "id" : "029", "name" : "029", + "id" : "029", "data" : [ [ "Perl", @@ -545,8 +843,6 @@ ] }, { - "name" : "030", - "id" : "030", "data" : [ [ "Perl", @@ -560,11 +856,11 @@ "Blog", 10 ] - ] + ], + "id" : "030", + "name" : "030" }, { - "id" : "031", - "name" : "031", "data" : [ [ "Perl", @@ -578,11 +874,13 @@ "Blog", 9 ] - ] + ], + "id" : "031", + "name" : "031" }, { - "id" : "032", "name" : "032", + "id" : "032", "data" : [ [ "Perl", @@ -600,7 +898,6 @@ }, { "id" : "033", - "name" : "033", "data" : [ [ "Perl", @@ -614,11 +911,12 @@ "Blog", 10 ] - ] + ], + "name" : "033" }, { - "id" : "034", "name" : "034", + "id" : "034", "data" : [ [ "Perl", @@ -635,8 +933,6 @@ ] }, { - "name" : "035", - "id" : "035", "data" : [ [ "Perl", @@ -650,11 +946,13 @@ "Blog", 9 ] - ] + ], + "id" : "035", + "name" : "035" }, { - "id" : "036", "name" : "036", + "id" : "036", "data" : [ [ "Perl", @@ -671,8 +969,8 @@ ] }, { - "id" : "037", "name" : "037", + "id" : "037", "data" : [ [ "Perl", @@ -689,6 +987,7 @@ ] }, { + "name" : "038", "data" : [ [ "Perl", @@ -703,12 +1002,9 @@ 12 ] ], - "id" : "038", - "name" : "038" + "id" : "038" }, { - "id" : "039", - "name" : "039", "data" : [ [ "Perl", @@ -722,9 +1018,13 @@ "Blog", 12 ] - ] + ], + "id" : "039", + "name" : "039" }, { + "name" : "040", + "id" : "040", "data" : [ [ "Perl", @@ -738,13 +1038,9 @@ "Blog", 10 ] - ], - "id" : "040", - "name" : "040" + ] }, { - "id" : "041", - "name" : "041", "data" : [ [ "Perl", @@ -758,10 +1054,11 @@ "Blog", 9 ] - ] + ], + "id" : "041", + "name" : "041" }, { - "id" : "042", "name" : "042", "data" : [ [ @@ -776,9 +1073,11 @@ "Blog", 11 ] - ] + ], + "id" : "042" }, { + "name" : "043", "data" : [ [ "Perl", @@ -793,12 +1092,9 @@ 10 ] ], - "id" : "043", - "name" : "043" + "id" : "043" }, { - "id" : "044", - "name" : "044", "data" : [ [ "Pe