From c5bb7a9eecf6f76df3eb782b7db1a34a3dc0416b Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:49:21 +0000 Subject: Challenge 263 Solutions (Raku) --- challenge-263/mark-anderson/raku/ch-1.raku | 11 +++++++++++ challenge-263/mark-anderson/raku/ch-2.raku | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 challenge-263/mark-anderson/raku/ch-1.raku create mode 100644 challenge-263/mark-anderson/raku/ch-2.raku diff --git a/challenge-263/mark-anderson/raku/ch-1.raku b/challenge-263/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..d029665e08 --- /dev/null +++ b/challenge-263/mark-anderson/raku/ch-1.raku @@ -0,0 +1,11 @@ +#!/usr/bin/env raku +use Test; + +is target-index((1,5,3,2,4,2), 2), (1,2); +is target-index((1,2,4,3,5), 6), (); +is target-index((5,3,2,4,2,1), 4), (4); + +sub target-index(@ints, $k) +{ + @ints.sort.grep($k, :k) +} diff --git a/challenge-263/mark-anderson/raku/ch-2.raku b/challenge-263/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..c3921fc60c --- /dev/null +++ b/challenge-263/mark-anderson/raku/ch-2.raku @@ -0,0 +1,15 @@ +#!/usr/bin/env raku +use Test; + +is merge-items([[1,1],[2,1],[3,2]], [[2,2],[1,3]]), ((1,4),(2,3),(3,2)); +is merge-items([[1,2],[2,3],[1,3],[3,2]], [[3,1],[1,3]]), ((1,8),(2,3),(3,3)); +is merge-items([[1,1],[2,2],[3,3]], [[2,3],[2,4]]), ((1,1),(2,9),(3,3)); + +sub merge-items($i1, $i2) +{ + given (|$i1, |$i2).classify({.head}, :as{.tail}) + { + .{.keys} = .values>>.sum; + sort .keys Z .values + } +} -- cgit From 0a90049d4a946b8662a3edcf0d9d7a0bff9a3289 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:56:09 +0000 Subject: Challenge 263 Solutions (Raku) --- challenge-263/mark-anderson/raku/ch-2.raku | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenge-263/mark-anderson/raku/ch-2.raku b/challenge-263/mark-anderson/raku/ch-2.raku index c3921fc60c..836c4d32f6 100644 --- a/challenge-263/mark-anderson/raku/ch-2.raku +++ b/challenge-263/mark-anderson/raku/ch-2.raku @@ -1,9 +1,9 @@ #!/usr/bin/env raku use Test; -is merge-items([[1,1],[2,1],[3,2]], [[2,2],[1,3]]), ((1,4),(2,3),(3,2)); -is merge-items([[1,2],[2,3],[1,3],[3,2]], [[3,1],[1,3]]), ((1,8),(2,3),(3,3)); -is merge-items([[1,1],[2,2],[3,3]], [[2,3],[2,4]]), ((1,1),(2,9),(3,3)); +is-deeply merge-items([[1,1],[2,1],[3,2]], [[2,2],[1,3]]), ((1,4),(2,3),(3,2)); +is-deeply merge-items([[1,2],[2,3],[1,3],[3,2]], [[3,1],[1,3]]), ((1,8),(2,3),(3,3)); +is-deeply merge-items([[1,1],[2,2],[3,3]], [[2,3],[2,4]]), ((1,1),(2,9),(3,3)); sub merge-items($i1, $i2) { -- cgit From ee575f05f5a82039837b4e8a86fb7f285649af7a Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 1 Apr 2024 06:01:01 +0000 Subject: Challenge 263 Solutions (Raku) --- challenge-263/mark-anderson/raku/ch-1.raku | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/challenge-263/mark-anderson/raku/ch-1.raku b/challenge-263/mark-anderson/raku/ch-1.raku index d029665e08..32b97979a5 100644 --- a/challenge-263/mark-anderson/raku/ch-1.raku +++ b/challenge-263/mark-anderson/raku/ch-1.raku @@ -1,9 +1,9 @@ #!/usr/bin/env raku use Test; -is target-index((1,5,3,2,4,2), 2), (1,2); -is target-index((1,2,4,3,5), 6), (); -is target-index((5,3,2,4,2,1), 4), (4); +is-deeply target-index((1,5,3,2,4,2), 2), (1,2); +is-deeply target-index((1,2,4,3,5), 6), (); +is-deeply target-index((5,3,2,4,2,1), 4), (4,); sub target-index(@ints, $k) { -- cgit From 75ed0a6a89810c3ef15322076d8f6b1a3c175ec3 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 1 Apr 2024 06:49:04 +0000 Subject: Challenge 263 Solutions (Raku) --- challenge-263/mark-anderson/raku/ch-2.raku | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/challenge-263/mark-anderson/raku/ch-2.raku b/challenge-263/mark-anderson/raku/ch-2.raku index 836c4d32f6..e303e361f3 100644 --- a/challenge-263/mark-anderson/raku/ch-2.raku +++ b/challenge-263/mark-anderson/raku/ch-2.raku @@ -9,7 +9,6 @@ sub merge-items($i1, $i2) { given (|$i1, |$i2).classify({.head}, :as{.tail}) { - .{.keys} = .values>>.sum; - sort .keys Z .values + sort .keys Z .values>>.sum } } -- cgit From 7da47ab176462dbcf92ac01c7931a7da1136757c Mon Sep 17 00:00:00 2001 From: Thomas Köhler Date: Mon, 1 Apr 2024 09:22:28 +0200 Subject: Add solution 263 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Köhler --- challenge-263/jeanluc2020/blog-1.txt | 1 + challenge-263/jeanluc2020/blog-2.txt | 1 + challenge-263/jeanluc2020/perl/ch-1.pl | 62 +++++++++++++++++++++++++ challenge-263/jeanluc2020/perl/ch-2.pl | 77 ++++++++++++++++++++++++++++++++ challenge-263/jeanluc2020/python/ch-1.py | 56 +++++++++++++++++++++++ challenge-263/jeanluc2020/python/ch-2.py | 75 +++++++++++++++++++++++++++++++ 6 files changed, 272 insertions(+) create mode 100644 challenge-263/jeanluc2020/blog-1.txt create mode 100644 challenge-263/jeanluc2020/blog-2.txt create mode 100755 challenge-263/jeanluc2020/perl/ch-1.pl create mode 100755 challenge-263/jeanluc2020/perl/ch-2.pl create mode 100755 challenge-263/jeanluc2020/python/ch-1.py create mode 100755 challenge-263/jeanluc2020/python/ch-2.py diff --git a/challenge-263/jeanluc2020/blog-1.txt b/challenge-263/jeanluc2020/blog-1.txt new file mode 100644 index 0000000000..03c12db1f2 --- /dev/null +++ b/challenge-263/jeanluc2020/blog-1.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-263-1.html diff --git a/challenge-263/jeanluc2020/blog-2.txt b/challenge-263/jeanluc2020/blog-2.txt new file mode 100644 index 0000000000..53ce1ab25b --- /dev/null +++ b/challenge-263/jeanluc2020/blog-2.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-263-2.html diff --git a/challenge-263/jeanluc2020/perl/ch-1.pl b/challenge-263/jeanluc2020/perl/ch-1.pl new file mode 100755 index 0000000000..6953f7a2ae --- /dev/null +++ b/challenge-263/jeanluc2020/perl/ch-1.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-263/#TASK1 +# +# Task 1: Target Index +# ==================== +# +# You are given an array of integers, @ints and a target element $k. +# +# Write a script to return the list of indices in the sorted array where the +# element is same as the given target element. +# +## Example 1 +## +## Input: @ints = (1, 5, 3, 2, 4, 2), $k = 2 +## Output: (1, 2) +## +## Sorted array: (1, 2, 2, 3, 4, 5) +## Target indices: (1, 2) as $ints[1] = 2 and $k[2] = 2 +# +## Example 2 +## +## Input: @ints = (1, 2, 4, 3, 5), $k = 6 +## Output: () +## +## No element in the given array matching the given target. +# +## Example 3 +## +## Input: @ints = (5, 3, 2, 4, 2, 1), $k = 4 +## Output: (4) +## +## Sorted array: (1, 2, 2, 3, 4, 5) +## Target index: (4) as $ints[4] = 4 +# +############################################################ +## +## discussion +## +############################################################ +# +# Straight forward steps: sort the input array, use an index to +# walk the array and remember the instances where $ints[$i] == $k. + +use strict; +use warnings; + +target_index( [1, 5, 3, 2, 4, 2], 2); +target_index( [1, 2, 4, 3, 5], 6); +target_index( [5, 3, 2, 4, 2, 1], 4); + +sub target_index { + my ($ints, $k) = @_; + print "Input: (" . join(", ", @$ints) . ")\n"; + my @result = (); + my @sorted = sort @$ints; + foreach my $i (0..$#sorted) { + if($sorted[$i] == $k) { + push @result, $i; + } + } + print "Output: (" . join(", ", @result) . ")\n"; +} diff --git a/challenge-263/jeanluc2020/perl/ch-2.pl b/challenge-263/jeanluc2020/perl/ch-2.pl new file mode 100755 index 0000000000..7ab660b370 --- /dev/null +++ b/challenge-263/jeanluc2020/perl/ch-2.pl @@ -0,0 +1,77 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-263/#TASK2 +# +# Task 2: Merge Items +# =================== +# +# You are given two 2-D array of positive integers, $items1 and $items2 where +# element is pair of (item_id, item_quantity). +# +# Write a script to return the merged items. +# +## Example 1 +## +## Input: $items1 = [ [1,1], [2,1], [3,2] ] +## $items2 = [ [2,2], [1,3] ] +## Output: [ [1,4], [2,3], [3,2] ] +## +## Item id (1) appears 2 times: [1,1] and [1,3]. Merged item now (1,4) +## Item id (2) appears 2 times: [2,1] and [2,2]. Merged item now (2,3) +## Item id (3) appears 1 time: [3,2] +# +## Example 2 +## +## Input: $items1 = [ [1,2], [2,3], [1,3], [3,2] ] +## $items2 = [ [3,1], [1,3] ] +## Output: [ [1,8], [2,3], [3,3] ] +# +## Example 3 +## +## Input: $items1 = [ [1,1], [2,2], [3,3] ] +## $items2 = [ [2,3], [2,4] ] +## Output: [ [1,1], [2,9], [3,3] ] +# +############################################################ +## +## discussion +## +############################################################ +# +# For this one, actually printing input and output is a little +# more tricky than the actual algorithm: Simply walk the combination +# of both arrays, and for each entry use the first element of that +# as the key of a result hash and the second element as what to add +# to the value of that entry in the hash. Print the result sorted +# by the hash keys. + +use strict; +use warnings; + +merge_items( [ [1,1], [2,1], [3,2] ], [ [2,2], [1,3] ] ); +merge_items( [ [1,2], [2,3], [1,3], [3,2] ], [ [3,1], [1,3] ] ); +merge_items( [ [1,1], [2,2], [3,3] ], [ [2,3], [2,4] ] ); + +sub merge_items { + my ($items1, $items2) = @_; + my $result; + print "Input: item1: ["; + foreach my $elem (@$items1) { + print "[$elem->[0], $elem->[1]],"; + } + print "],\n"; + print " item2: ["; + foreach my $elem (@$items2) { + print "[$elem->[0], $elem->[1]],"; + } + print "]\n"; + + foreach my $elem( (@$items1, @$items2) ) { + $result->{$elem->[0]} += $elem->[1]; + } + + print "Output: ["; + foreach my $elem (sort {$a <=> $b} keys %$result) { + print "[$elem, $result->{$elem}],"; + } + print "]\n"; +} diff --git a/challenge-263/jeanluc2020/python/ch-1.py b/challenge-263/jeanluc2020/python/ch-1.py new file mode 100755 index 0000000000..ebfafa7558 --- /dev/null +++ b/challenge-263/jeanluc2020/python/ch-1.py @@ -0,0 +1,56 @@ +#!/usr/bin/python3 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-263/#TASK1 +# +# Task 1: Target Index +# ==================== +# +# You are given an array of integers, @ints and a target element $k. +# +# Write a script to return the list of indices in the sorted array where the +# element is same as the given target element. +# +## Example 1 +## +## Input: @ints = (1, 5, 3, 2, 4, 2), $k = 2 +## Output: (1, 2) +## +## Sorted array: (1, 2, 2, 3, 4, 5) +## Target indices: (1, 2) as $ints[1] = 2 and $k[2] = 2 +# +## Example 2 +## +## Input: @ints = (1, 2, 4, 3, 5), $k = 6 +## Output: () +## +## No element in the given array matching the given target. +# +## Example 3 +## +## Input: @ints = (5, 3, 2, 4, 2, 1), $k = 4 +## Output: (4) +## +## Sorted array: (1, 2, 2, 3, 4, 5) +## Target index: (4) as $ints[4] = 4 +# +############################################################ +## +## discussion +## +############################################################ +# +# Straight forward steps: sort the input array, use an index to +# walk the array and remember the instances where $ints[$i] == $k. + +def target_index(ints: list, k: int) -> None: + print("Input: (", ", ".join(str(x) for x in ints), ")", sep="") + result = [] + sorted_ints = sorted(ints) + for i in range(len(sorted_ints)): + if sorted_ints[i] == k: + result.append(i) + print("Output: (", ", ".join(str(x) for x in result), ")", sep="") + +target_index( [1, 5, 3, 2, 4, 2], 2); +target_index( [1, 2, 4, 3, 5], 6); +target_index( [5, 3, 2, 4, 2, 1], 4); + diff --git a/challenge-263/jeanluc2020/python/ch-2.py b/challenge-263/jeanluc2020/python/ch-2.py new file mode 100755 index 0000000000..1944346edb --- /dev/null +++ b/challenge-263/jeanluc2020/python/ch-2.py @@ -0,0 +1,75 @@ +#!/usr/bin/python3 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-263/#TASK2 +# +# Task 2: Merge Items +# =================== +# +# You are given two 2-D array of positive integers, $items1 and $items2 where +# element is pair of (item_id, item_quantity). +# +# Write a script to return the merged items. +# +## Example 1 +## +## Input: $items1 = [ [1,1], [2,1], [3,2] ] +## $items2 = [ [2,2], [1,3] ] +## Output: [ [1,4], [2,3], [3,2] ] +## +## Item id (1) appears 2 times: [1,1] and [1,3]. Merged item now (1,4) +## Item id (2) appears 2 times: [2,1] and [2,2]. Merged item now (2,3) +## Item id (3) appears 1 time: [3,2] +# +## Example 2 +## +## Input: $items1 = [ [1,2], [2,3], [1,3], [3,2] ] +## $items2 = [ [3,1], [1,3] ] +## Output: [ [1,8], [2,3], [3,3] ] +# +## Example 3 +## +## Input: $items1 = [ [1,1], [2,2], [3,3] ] +## $items2 = [ [2,3], [2,4] ] +## Output: [ [1,1], [2,9], [3,3] ] +# +############################################################ +## +## discussion +## +############################################################ +# +# For this one, actually printing input and output is a little +# more tricky than the actual algorithm: Simply walk the combination +# of both arrays, and for each entry use the first element of that +# as the key of a result hash and the second element as what to add +# to the value of that entry in the hash. Print the result sorted +# by the hash keys. + +def merge_items(items1: list, items2: list) -> None: + result = {} + print("Input: items1 = [ ", end="") + for elem in items1: + print("[", elem[0], ", ", elem[1], "], ", sep="", end="") + print("],") + print(" items2 = [", end="") + for elem in items1: + print("[", elem[0], ", ", elem[1], "], ", sep="", end="") + print("]") + + all = items1 + for x in items2: + all.append(x) + for elem in all: + if elem[0] in result: + result[elem[0]] += elem[1] + else: + result[elem[0]] = elem[1] + + print("Output: [", end="") + for elem in sorted(result): + print("[", elem, ", ", result[elem], "], ", sep="", end="") + print("]") + +merge_items( [ [1,1], [2,1], [3,2] ], [ [2,2], [1,3] ] ); +merge_items( [ [1,2], [2,3], [1,3], [3,2] ], [ [3,1], [1,3] ] ); +merge_items( [ [1,1], [2,2], [3,3] ], [ [2,3], [2,4] ] ); + -- cgit From 9b56207d14f09c06c6f4f480f2981366edc8de0a Mon Sep 17 00:00:00 2001 From: 冯昶 Date: Mon, 1 Apr 2024 16:03:05 +0800 Subject: challenge 263, raku solutions --- challenge-263/feng-chang/raku/ch-1.raku | 6 ++++++ challenge-263/feng-chang/raku/ch-2.raku | 10 ++++++++++ challenge-263/feng-chang/raku/test.raku | 27 +++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100755 challenge-263/feng-chang/raku/ch-1.raku create mode 100755 challenge-263/feng-chang/raku/ch-2.raku create mode 100755 challenge-263/feng-chang/raku/test.raku diff --git a/challenge-263/feng-chang/raku/ch-1.raku b/challenge-263/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..7f02543374 --- /dev/null +++ b/challenge-263/feng-chang/raku/ch-1.raku @@ -0,0 +1,6 @@ +#!/bin/env raku + +unit sub MAIN(*@ints); + +my \k = @ints.pop; +put @ints.sort.grep(k, :k).gist; diff --git a/challenge-263/feng-chang/raku/ch-2.raku b/challenge-263/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..aa93ae7c2a --- /dev/null +++ b/challenge-263/feng-chang/raku/ch-2.raku @@ -0,0 +1,10 @@ +#!/bin/env raku + +unit sub MAIN(Str:D $s1, Str:D $s2); + +use MONKEY-SEE-NO-EVAL; + +my @items = EVAL "$s1, $s2"; +my %merged; +%merged{$_[0]} += $_[1] for @items; +put %merged.keys.sort.map({ [ +$_, %merged{$_} ] }).Array.raku; diff --git a/challenge-263/feng-chang/raku/test.raku b/challenge-263/feng-chang/raku/test.raku new file mode 100755 index 0000000000..8a2cd6dc4c --- /dev/null +++ b/challenge-263/feng-chang/raku/test.raku @@ -0,0 +1,27 @@ +#!/bin/env raku + +# The Weekly Challenge 263 +use Test; + +sub pwc-test(Str:D $script, Bool :$deeply? = False, *@input) { + my ($expect, $assertion) = @input.splice(*-2, 2); + my $p = run $script, |@input, :out; + if $deeply { + is-deeply $p.out.slurp(:close).chomp.words.Bag, $expect, $assertion; + } else { + is $p.out.slurp(:close).chomp, $expect, $assertion; + } +} + +# Task 1, Target Index +pwc-test './ch-1.raku', <1 5 3 2 4 2>, 2, '(1 2)', 'Target Index: @ints = (1,5,3,2,4,2), $k=2 => (1, 2)'; +pwc-test './ch-1.raku', <1 2 4 3 5>, 6, '()', 'Target Index: @ints = (1,2,4,3,5), $k=6 => ()'; +pwc-test './ch-1.raku', <5 3 2 4 2 1>, 4, '(4)', 'Target Index: @ints = (5,3,2,4,2,1), $k=4 => (4)'; + +# Task 2, Merge Items +pwc-test './ch-2.raku', '[1,1],[2,1],[3,2]', '[2,2],[1,3]', '[[1, 4], [2, 3], [3, 2]]', + 'Merge Items: $items1 = [[1,1],[2,1],[3,2]], $items2 = [[2,2],[1,3]] => [[1,4],[2,3],[3,2]]'; +pwc-test './ch-2.raku', '[1,2],[2,3],[1,3],[3,2]', '[3,1],[1,3]', '[[1, 8], [2, 3], [3, 3]]', + 'Merge Items: $items1 = [[1,2],[2,3],[1,3],[3,2]], $items2 = [[3,1],[1,3]] => [[1,8],[2,3],[3,3]]'; +pwc-test './ch-2.raku', '[1,1],[2,2],[3,3]', '[2,3],[2,4]', '[[1, 1], [2, 9], [3, 3]]', + 'Merge Items: $items1 = [[1,1],[2,2],[3,3]], $items2 = [[2,3],[2,4]] => [[1, 1], [2, 9], [3, 3]]'; -- cgit From e8291e11dd0db9f18879945797a3abbf0752e1c3 Mon Sep 17 00:00:00 2001 From: 冯昶 Date: Mon, 1 Apr 2024 16:17:12 +0800 Subject: ch-2a.raku: task 2 1-liner --- challenge-263/feng-chang/raku/ch-2a.raku | 7 +++++++ challenge-263/feng-chang/raku/test.raku | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100755 challenge-263/feng-chang/raku/ch-2a.raku diff --git a/challenge-263/feng-chang/raku/ch-2a.raku b/challenge-263/feng-chang/raku/ch-2a.raku new file mode 100755 index 0000000000..1b8f481323 --- /dev/null +++ b/challenge-263/feng-chang/raku/ch-2a.raku @@ -0,0 +1,7 @@ +#!/bin/env raku + +unit sub MAIN(Str:D $s1, Str:D $s2); + +use MONKEY-SEE-NO-EVAL; + +put (EVAL "$s1, $s2").map({ $_[0] xx $_[1] }).Bag.sort(+*.key).map({ [+.key, .value] }).Array.raku; diff --git a/challenge-263/feng-chang/raku/test.raku b/challenge-263/feng-chang/raku/test.raku index 8a2cd6dc4c..c35a6af606 100755 --- a/challenge-263/feng-chang/raku/test.raku +++ b/challenge-263/feng-chang/raku/test.raku @@ -25,3 +25,10 @@ pwc-test './ch-2.raku', '[1,2],[2,3],[1,3],[3,2]', '[3,1],[1,3]', '[[1, 8], [2, 'Merge Items: $items1 = [[1,2],[2,3],[1,3],[3,2]], $items2 = [[3,1],[1,3]] => [[1,8],[2,3],[3,3]]'; pwc-test './ch-2.raku', '[1,1],[2,2],[3,3]', '[2,3],[2,4]', '[[1, 1], [2, 9], [3, 3]]', 'Merge Items: $items1 = [[1,1],[2,2],[3,3]], $items2 = [[2,3],[2,4]] => [[1, 1], [2, 9], [3, 3]]'; + +pwc-test './ch-2a.raku', '[1,1],[2,1],[3,2]', '[2,2],[1,3]', '[[1, 4], [2, 3], [3, 2]]', + 'Merge Items: $items1 = [[1,1],[2,1],[3,2]], $items2 = [[2,2],[1,3]] => [[1,4],[2,3],[3,2]]'; +pwc-test './ch-2a.raku', '[1,2],[2,3],[1,3],[3,2]', '[3,1],[1,3]', '[[1, 8], [2, 3], [3, 3]]', + 'Merge Items: $items1 = [[1,2],[2,3],[1,3],[3,2]], $items2 = [[3,1],[1,3]] => [[1,8],[2,3],[3,3]]'; +pwc-test './ch-2a.raku', '[1,1],[2,2],[3,3]', '[2,3],[2,4]', '[[1, 1], [2, 9], [3, 3]]', + 'Merge Items: $items1 = [[1,1],[2,2],[3,3]], $items2 = [[2,3],[2,4]] => [[1, 1], [2, 9], [3, 3]]'; -- cgit From 3ceabd6fa98eb08d132299ebe87605c5199d8a76 Mon Sep 17 00:00:00 2001 From: pme Date: Mon, 1 Apr 2024 13:44:09 +0200 Subject: challenge-263 --- challenge-263/peter-meszaros/perl/ch-1.pl | 67 ++++++++++++++++++++++++++++++ challenge-263/peter-meszaros/perl/ch-2.pl | 69 +++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100755 challenge-263/peter-meszaros/perl/ch-1.pl create mode 100755 challenge-263/peter-meszaros/perl/ch-2.pl diff --git a/challenge-263/peter-meszaros/perl/ch-1.pl b/challenge-263/peter-meszaros/perl/ch-1.pl new file mode 100755 index 0000000000..1b2128d8b0 --- /dev/null +++ b/challenge-263/peter-meszaros/perl/ch-1.pl @@ -0,0 +1,67 @@ +#!/usr/bin/env perl +# +# You are given an array of integers, @ints and a target element $k. +# +# Write a script to return the list of indices in the sorted array where the +# element is same as the given target element. +# Example 1 +# +# Input: @ints = (1, 5, 3, 2, 4, 2), $k = 2 +# Output: (1, 2) +# +# Sorted array: (1, 2, 2, 3, 4, 5) +# Target indices: (1, 2) as $ints[1] = 2 and $k[2] = 2 +# +# Example 2 +# +# Input: @ints = (1, 2, 4, 3, 5), $k = 6 +# Output: () +# +# No element in the given array matching the given target. +# +# Example 3 +# +# Input: @ints = (5, 3, 2, 4, 2, 1), $k = 4 +# Output: (4) +# +# Sorted array: (1, 2, 2, 3, 4, 5) +# Target index: (4) as $ints[4] = 4 +# + +use strict; +use warnings; +use Test2::V0 -no_srand => 1; +use Data::Dumper; + +my $cases = [ + [[[1, 5, 3, 2, 4, 2], 2], [1, 2], 'Example 1'], + [[[1, 2, 4, 3, 5], 6], [], 'Example 2'], + [[[5, 3, 2, 4, 2, 1], 4], [4], 'Example 3'], +]; + +sub target_index +{ + my $l = $_->[0]->[0]; + my $k = $_->[0]->[1]; + + my @l = sort {$a <=> $b} @$l; + my @res; + + my $found; + for (0..$#l) { + if ($l[$_] == $k) { + push @res, $_; + $found = 1; + } elsif ($found) { + last; + } + } + return \@res; +} + +for (@$cases) { + is(target_index($_->[0]), $_->[1], $_->[2]); +} +done_testing(); + +exit 0; diff --git a/challenge-263/peter-meszaros/perl/ch-2.pl b/challenge-263/peter-meszaros/perl/ch-2.pl new file mode 100755 index 0000000000..4b3cad77ac --- /dev/null +++ b/challenge-263/peter-meszaros/perl/ch-2.pl @@ -0,0 +1,69 @@ +#!/usr/bin/env perl +# +# You are given two 2-D array of positive integers, $items1 and $items2 where +# element is pair of (item_id, item_quantity). +# +# Write a script to return the merged items. +# Example 1 +# +# Input: $items1 = [ [1,1], [2,1], [3,2] ] +# $items2 = [ [2,2], [1,3] ] +# Output: [ [1,4], [2,3], [3,2] ] +# +# Item id (1) appears 2 times: [1,1] and [1,3]. Merged item now (1,4) +# Item id (2) appears 2 times: [2,1] and [2,2]. Merged item now (2,3) +# Item id (3) appears 1 time: [3,2] +# +# Example 2 +# +# Input: $items1 = [ [1,2], [2,3], [1,3], [3,2] ] +# $items2 = [ [3,1], [1,3] ] +# Output: [ [1,8], [2,3], [3,3] ] +# +# Example 3 +# +# Input: $items1 = [ [1,1], [2,2], [3,3] ] +# $items2 = [ [2,3], [2,4] ] +# Output: [ [1,1], [2,9], [3,3] ] +# + +use strict; +use warnings; +use Test2::V0 -no_srand => 1; +use Data::Dumper; + +my $cases = [ + [[[[1,1], [2,1], [3,2]], [[2,2], [1,3]]], + [[1,4], [2,3], [3,2]], 'Example 1'], + [[[[1,2], [2,3], [1,3], [3,2]], [[3,1], [1,3]]], + [[1,8], [2,3], [3,3]], 'Example 2'], + [[[[1,1], [2,2], [3,3]], [[2,3], [2,4]]], + [[1,1], [2,9], [3,3]], 'Example 3'], +]; + +sub merge_items +{ + my $l1 = $_->[0]->[0]; + my $l2 = $_->[0]->[1]; + + my %l; + + for my $i (@$l1, @$l2) { + $l{$i->[0]} += $i->[1]; + } + + my @res; + for my $k (sort {$a <=> $b} keys %l) { + push @res, [$k, $l{$k}]; + } + + return \@res; +} + +for (@$cases) { + is(merge_items($_->[0]), $_->[1], $_->[2]); +} +done_testing(); + +exit 0; + -- cgit From 396e9f2d45acf65e2dd8dbde30a77a6aa0ef227a Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 1 Apr 2024 15:59:18 +0100 Subject: add solutions week 263 in python --- challenge-263/steven-wilson/python/ch-1.py | 21 +++++++++++++++++++++ challenge-263/steven-wilson/python/ch-2.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 challenge-263/steven-wilson/python/ch-1.py create mode 100644 challenge-263/steven-wilson/python/ch-2.py diff --git a/challenge-263/steven-wilson/python/ch-1.py b/challenge-263/steven-wilson/python/ch-1.py new file mode 100644 index 0000000000..c5812d1069 --- /dev/null +++ b/challenge-263/steven-wilson/python/ch-1.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + + +def target_index(*elements, target): + ''' Given an array of integers and a target element, return the list of + indices in the sorted array where the element is same as the given target + element. + >>> target_index(1, 5, 3, 2, 4, 2, target=2) + [1, 2] + >>> target_index(1, 2, 4, 3, 5, target = 6) + [] + >>> target_index(5, 3, 2, 4, 2, 1, target = 4) + [4] + ''' + return [i for i, elem in enumerate(sorted(elements)) if elem == target] + + +if __name__ == "__main__": + import doctest + + doctest.testmod() diff --git a/challenge-263/steven-wilson/python/ch-2.py b/challenge-263/steven-wilson/python/ch-2.py new file mode 100644 index 0000000000..40895fcd98 --- /dev/null +++ b/challenge-263/steven-wilson/python/ch-2.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +from collections import Counter + + +def merge_items(items1, items2): + ''' Given two 2-D array of positive integers, items1 and items2 where + element is pair of (item_id, item_quantity), return the merged items. + >>> merge_items([ [1,1], [2,1], [3,2] ], [ [2,2], [1,3] ]) + [[1, 4], [2, 3], [3, 2]] + >>> merge_items([[1, 2], [2, 3], [1, 3], [3, 2]], [[3, 1], [1, 3]]) + [[1, 8], [2, 3], [3, 3]] + >>> merge_items([[1, 1], [2, 2], [3, 3]], [[2, 3], [2, 4]]) + [[1, 1], [2, 9], [3, 3]] + ''' + counter = Counter() + all_items = items1 + items2 + + for item in all_items: + counter[item[0]] += item[1] + + return [[item_id, counter[item_id]] for item_id in sorted(counter.keys())] + + +if __name__ == "__main__": + import doctest + + doctest.testmod() -- cgit From 4ad3ae4e7aab284c0a667bd2b8e1417becf5407d Mon Sep 17 00:00:00 2001 From: Luis Mochan Date: Mon, 1 Apr 2024 10:43:56 -0600 Subject: Solve PWC263 --- challenge-263/wlmb/blog.txt | 1 + challenge-263/wlmb/perl/ch-1.pl | 15 +++++++++++++++ challenge-263/wlmb/perl/ch-2.pl | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 challenge-263/wlmb/blog.txt create mode 100755 challenge-263/wlmb/perl/ch-1.pl create mode 100755 challenge-263/wlmb/perl/ch-2.pl diff --git a/challenge-263/wlmb/blog.txt b/challenge-263/wlmb/blog.txt new file mode 100644 index 0000000000..df4b1ab879 --- /dev/null +++ b/challenge-263/wlmb/blog.txt @@ -0,0 +1 @@ +https://wlmb.github.io/2024/04/01/PWC263/ diff --git a/challenge-263/wlmb/perl/ch-1.pl b/challenge-263/wlmb/perl/ch-1.pl new file mode 100755 index 0000000000..ca679844b5 --- /dev/null +++ b/challenge-263/wlmb/perl/ch-1.pl @@ -0,0 +1,15 @@ +#!/usr/bin/env perl +# Perl weekly challenge 263 +# Task 1: Target Index +# +# See https://wlmb.github.io/2024/04/01/PWC263/#task-1-target-index +use v5.36; +die <<~"FIN" unless @ARGV; + Usage: $0 k N0 [N1...] + to find the indices of the array N0 N1... (after sorting) for which + N_i=k + FIN +my $k=shift; +my @sorted=sort{$a<=>$b}@ARGV; +say "k=$k, ints=(@ARGV) -> ", + join " ", "(", grep({$sorted[$_]==$k} (0..@sorted-1)), ")"; diff --git a/challenge-263/wlmb/perl/ch-2.pl b/challenge-263/wlmb/perl/ch-2.pl new file mode 100755 index 0000000000..a4a5dd3337 --- /dev/null +++ b/challenge-263/wlmb/perl/ch-2.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl +# Perl weekly challenge 263 +# Task 2: Merge Items +# +# See https://wlmb.github.io/2024/04/01/PWC263/#task-2-merge-items +use v5.36; +use PDL; # use the perl data language to convert the input to a list of keys-values +use experimental qw(for_list); # use for list to process key-value pairs +die <<~"FIN" unless @ARGV; + Usage: $0 "[[K11,V11],[K12,V12]...]]" "[[K21,V21],[K22,V22],...]" ... + to accumulate all values Vij corresponding to each unique key Kn=Kij + FIN +my @keyvals; +push @keyvals, pdl($_)->list for @ARGV; +my %merged; +for my($key, $val)(@keyvals){ + $merged{$key}+=$val +}; +my @result = map {"[$_,$merged{$_}]"} sort {$a cmp $b} keys %merged; +say "@ARGV -> [@result]"; -- cgit From 6e3cd6e8a2eb65b0ba00b4e15e1abeb689a33e8d Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 1 Apr 2024 18:17:24 +0100 Subject: - Added solutions by Mark Anderson. - Added solutions by Thomas Kohler. - Added solutions by Feng Chang. - Added solutions by Peter Meszaros. - Added solutions by Andrew Shitov. - Added solutions by Steven Wilson. - Added solutions by W. Luis Mochan. - Added solutions by James Smith. - Added solutions by Wanderdoc. - Added solutions by Laurent Rosenfeld. - Added solutions by Eric Cheung. --- challenge-263/eric-cheung/python/ch-1.py | 16 + challenge-263/eric-cheung/python/ch-2.py | 18 + challenge-263/james-smith/blog.txt | 1 + challenge-263/james-smith/perl/ch-1.pl | 5 + challenge-263/james-smith/perl/ch-2.pl | 7 + challenge-263/laurent-rosenfeld/blog.txt | 1 + challenge-263/laurent-rosenfeld/perl/ch-1.pl | 18 + challenge-263/laurent-rosenfeld/raku/ch-1.raku | 13 + challenge-263/wanderdoc/perl/ch-1.pl | 53 + challenge-263/wanderdoc/perl/ch-2.pl | 45 + stats/pwc-challenge-262.json | 668 ++ stats/pwc-current.json | 549 +- stats/pwc-language-breakdown-summary.json | 82 +- stats/pwc-language-breakdown.json | 10313 ++++++++++++----------- stats/pwc-leaders.json | 402 +- stats/pwc-summary-1-30.json | 116 +- stats/pwc-summary-121-150.json | 56 +- stats/pwc-summary-151-180.json | 52 +- stats/pwc-summary-181-210.json | 122 +- stats/pwc-summary-211-240.json | 38 +- stats/pwc-summary-241-270.json | 46 +- stats/pwc-summary-271-300.json | 52 +- stats/pwc-summary-301-330.json | 60 +- stats/pwc-summary-31-60.json | 44 +- stats/pwc-summary-61-90.json | 96 +- stats/pwc-summary-91-120.json | 36 +- stats/pwc-summary.json | 58 +- 27 files changed, 6687 insertions(+), 6280 deletions(-) create mode 100755 challenge-263/eric-cheung/python/ch-1.py create mode 100755 challenge-263/eric-cheung/python/ch-2.py create mode 100644 challenge-263/james-smith/blog.txt create mode 100644 challenge-263/james-smith/perl/ch-1.pl create mode 100644 challenge-263/james-smith/perl/ch-2.pl create mode 100644 challenge-263/laurent-rosenfeld/blog.txt create mode 100644 challenge-263/laurent-rosenfeld/perl/ch-1.pl create mode 100644 challenge-263/laurent-rosenfeld/raku/ch-1.raku create mode 100755 challenge-263/wanderdoc/perl/ch-1.pl create mode 100755 challenge-263/wanderdoc/perl/ch-2.pl create mode 100644 stats/pwc-challenge-262.json diff --git a/challenge-263/eric-cheung/python/ch-1.py b/challenge-263/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..7c330e0eda --- /dev/null +++ b/challenge-263/eric-cheung/python/ch-1.py @@ -0,0 +1,16 @@ + +## Example 1 +## arrInt = [1, 5, 3, 2, 4, 2] +## nK = 2 + +## Example 2 +## arrInt = [1, 2, 4, 3, 5] +## nK = 6 + +## Example 3 +arrInt = [5, 3, 2, 4, 2, 1] +nK = 4 + +arrOutput = [nIndxLoop for nIndxLoop, elemLoop in enumerate(sorted(arrInt)) if elemLoop == nK] + +print (arrOutput) diff --git a/challenge-263/eric-cheung/python/ch-2.py b/challenge-263/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..b50b2084d7 --- /dev/null +++ b/challenge-263/eric-cheung/python/ch-2.py @@ -0,0 +1,18 @@ + +## Example 1 +## arrItem_01 = [[1, 1], [2, 1], [3, 2]] +## arrItem_02 = [[2, 2], [1, 3]] + +## Example 2 +## arrItem_01 = [[1, 2], [2, 3], [1, 3], [3, 2]] +## arrItem_02 = [[3, 1], [1, 3]] + +## Example 3 +arrItem_01 = [[1, 1], [2, 2], [3, 3]] +arrItem_02 = [[2, 3], [2, 4]] + +arrCombine = arrItem_01 + arrItem_02 +arrUniq = set([arrLoop[0] for arrLoop in arrCombine]) +arrOutput = [[elemLoop, sum([arrLoop[1] for arrLoop in arrCombine if arrLoop[0] == elemLoop])] for elemLoop in arrUniq] + +print (arrOutput) diff --git a/challenge-263/james-smith/blog.txt b/challenge-263/james-smith/blog.txt new file mode 100644 index 0000000000..e69ad27da2 --- /dev/null +++ b/challenge-263/james-smith/blog.txt @@ -0,0 +1 @@ +https://challenges.jamessmith.me.uk/weekly/weekly-challenge-263 diff --git a/challenge-263/james-smith/perl/ch-1.pl b/challenge-263/james-smith/perl/ch-1.pl new file mode 100644 index 0000000000..7534c1232c --- /dev/null +++ b/challenge-263/james-smith/perl/ch-1.pl @@ -0,0 +1,5 @@ +sub target_index { + my( $k, @c ) = ( pop, 0, 0, 0 ); + $c[ $_ <=> $k ]++ for @_; + $c[2] .. $c[2] + $c[0] - 1 +} diff --git a/challenge-263/james-smith/perl/ch-2.pl b/challenge-263/james-smith/perl/ch-2.pl new file mode 100644 index 0000000000..784e4ca62c --- /dev/null +++ b/challenge-263/james-smith/perl/ch-2.pl @@ -0,0 +1,7 @@ +sub merge_items { + my %c; + for( @_ ) { + $c{ $_->[0] } += $_->[1] for @{$_} + } + map { [ 0 + $_ => $c{$_} ] } keys %c +} diff --git a/challenge-263/laurent-rosenfeld/blog.txt b/challenge-263/laurent-rosenfeld/blog.txt new file mode 100644 index 0000000000..90950b58da --- /dev/null +++ b/challenge-263/laurent-rosenfeld/blog.txt @@ -0,0 +1 @@ +https://blogs.perl.org/users/laurent_r/2024/04/perl-weekly-challenge-263-target-index.html diff --git a/challenge-263/laurent-rosenfeld/perl/ch-1.pl b/challenge-263/laurent-rosenfeld/perl/ch-1.pl new file mode 100644 index 0000000000..674699715d --- /dev/null +++ b/challenge-263/laurent-rosenfeld/perl/ch-1.pl @@ -0,0 +1,18 @@ +use strict; +use warnings; +use feature 'say'; + +sub find_index { + my $target = shift; + my @sorted = sort { $a <=> $b } @_; + my @out = grep {$sorted[$_] == $target} 0..$#sorted; + return "@out" || "()"; +} + +my @tests = ( [2, [1, 5, 3, 2, 4, 2]], + [6, [1, 2, 4, 3, 5]], + [4, [5, 3, 2, 4, 2, 1]] ); +for my $test (@tests) { + printf "%d - %-15s => ", $test->[0], "@{$test->[1]}"; + say find_index @$test[0], @{$test->[1]}; +} diff --git a/challenge-263/laurent-rosenfeld/raku/ch-1.raku b/challenge-263/laurent-rosenfeld/raku/ch-1.raku new file mode 100644 index 0000000000..35b95147f4 --- /dev/null +++ b/challenge-263/laurent-rosenfeld/raku/ch-1.raku @@ -0,0 +1,13 @@ +sub find-index ($target, @in) { + my @sorted = @in.sort; + my @out = grep {@sorted[$_] == $target}, 0..@sorted.end; + return @out; +} + +my @tests = (2, (1, 5, 3, 2, 4, 2)), + (6, (1, 2, 4, 3, 5)), + (4, (5, 3, 2, 4, 2, 1)); +for @tests -> @test { + printf "%d - %-15s => ", @test[0], "@test[1]"; + say find-index @test[0], @test[1]; +} diff --git a/challenge-263/wanderdoc/perl/ch-1.pl b/challenge-263/wanderdoc/perl/ch-1.pl new file mode 100755 index 0000000000..97a5973fb5 --- /dev/null +++ b/challenge-263/wanderdoc/perl/ch-1.pl @@ -0,0 +1,53 @@ +#!perl +use strict; +use warnings FATAL => qw(all); + +=prompt +You are given an array of integers, @ints and a target element $k. Write a script to return the list of indices in the sorted array where the element is same as the given target element. + +Example 1 +Input: @ints = (1, 5, 3, 2, 4, 2), $k = 2 +Output: (1, 2) +Sorted array: (1, 2, 2, 3, 4, 5) +Target indices: (1, 2) as $ints[1] = 2 and $k[2] = 2 + +Example 2 +Input: @ints = (1, 2, 4, 3, 5), $k = 6 +Output: () +No element in the given array matching the given target. + +Example 3 + +Input: @ints = (5, 3, 2, 4, 2, 1), $k = 4 +Output: (4) +Sorted array: (1, 2, 2, 3, 4, 5) +Target index: (4) as $ints[4] = 4 +=cut + +use Sort::Key qw(nkeysort); +use List::MoreUtils qw(indexes); +use integer; +use Test2::V0; + +is(target_index([1, 5, 3, 2, 4, 2], 2), [1, 2], 'Example 1'); +is(target_index([1, 2, 4, 3, 5], 6), [], 'Example 2'); +is(target_index([5, 3, 2, 4, 2, 1], 4), [4], 'Example 3'); +done_testing(); + +sub target_index +{ + my ($aref, $elm) = @_; + return + [indexes { $_ == $elm } nkeysort {$_} @$aref]; +} + + + + + + + +# use Data::Dump; +# dd target_index([1, 5, 3, 2, 4, 2], 2); +# dd target_index([1, 2, 4, 3, 5], 6); +# dd target_index([5, 3, 2, 4, 2, 1], 4); \ No newline at end of file diff --git a/challenge-263/wanderdoc/perl/ch-2.pl b/challenge-263/wanderdoc/perl/ch-2.pl new file mode 100755 index 0000000000..1f3657bb04 --- /dev/null +++ b/challenge-263/wanderdoc/perl/ch-2.pl @@ -0,0 +1,45 @@ +#!perl +use strict; +use warnings FATAL => qw(all); + +=prompt +You are given two 2-D array of positive integers, $items1 and $items2 where element is pair of (item_id, item_quantity). Write a script to return the merged items. +Example 1 +Input: $items1 = [ [1,1], [2,1], [3,2] ] $items2 = [ [2,2], [1,3] ] +Output: [ [1,4], [2,3], [3,2] ] +Item id (1) appears 2 times: [1,1] and [1,3]. Merged item now (1,4) +Item id (2) appears 2 times: [2,1] and [2,2]. Merged item now (2,3) +Item id (3) appears 1 time: [3,2] + +Example 2 +Input: $items1 = [ [1,2], [2,3], [1,3], [3,2] ] $items2 = [ [3,1], [1,3] ] +Output: [ [1,8], [2,3], [3,3] ] + +Example 3 +Input: $items1 = [ [1,1], [2,2], [3,3] ] $items2 = [ [2,3], [2,4] ] +Output: [ [1,1], [2,9], [3,3] ] +=cut + +use Sort::Key qw(nkeysort); +use Test2::V0; + + +is(merge_items([ [1,1], [2,1], [3,2] ], [ [2,2], [1,3] ]), + [ [1,4], [2,3], [3,2] ], 'Example 1'); +is(merge_items([ [1,2], [2,3], [1,3], [3,2] ], [ [3,1], [1,3] ]), + [ [1,8], [2,3], [3,3] ], 'Example 2'); +is(merge_items([ [1,1], [2,2], [3,3] ], [ [2,3], [2,4] ]), + [ [1,1], [2,9], [3,3] ], 'Example 3'); + done_testing(); + +sub merge_items +{ + use integer; + my @arefs = @_; + my %merge; + for my $paar ( map { @$_ } @arefs ) + { + $merge{ $paar->[0] } += $paar->[1]; + } + return [ map { [$_, $merge{$_}] } nkeysort{$_} keys %merge ]; +} diff --git a/stats/pwc-challenge-262.json b/stats/pwc-challenge-262.json new file mode 100644 index 0000000000..e0c7c6b82c --- /dev/null +++ b/stats/pwc-challenge-262.json @@ -0,0 +1,668 @@ +{ + "legend" : { + "enabled" : 0 + }, + "chart" : { + "type" : "column" + }, + "tooltip" : { + "pointFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", + "followPointer" : 1 + }, + "xAxis" : { + "type" : "category" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "name" : "Adam Russell", + "y" : 2, + "drilldown" : "Adam Russell" + }, + { + "drilldown" : "Ali Moradi", + "y" : 3, + "name" : "Ali Moradi" + }, + { + "name" : "Andrew Shitov", + "drilldown" : "Andrew Shitov", + "y" : 2 + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "drilldown" : "Asher Harvey-Smith", + "y" : 2, + "name" : "Asher Harvey-Smith" + }, + { + "y" : 4, + "drilldown" : "Athanasius", + "name" : "Athanasius" + }, + { + "y" : 3, + "drilldown" : "BarrOff", + "name" : "BarrOff" + }, + { + "name" : "Bob Lied", + "drilldown" : "Bob Lied", + "y" : 3 + }, + { + "name" : "Bruce Gray", + "drilldown" : "Bruce Gray", + "y" : 2 + }, + { + "name" : "Cheok-Yin Fung", + "y" : 2, + "drilldown" : "Cheok-Yin Fung" + }, + { + "drilldown" : "Dave Jacoby", + "y" : 2, + "name" : "Dave Jacoby" + }, + { + "drilldown" : "David Ferrone", + "y" : 2, + "name" : "David Ferrone" + }, + { + "drilldown" : "E. Choroba", + "y" : 2, + "name" : "E. Choroba" + }, + { + "name" : "Feng Chang", + "y" : 2, + "drilldown" : "Feng Chang" + }, + { + "y" : 2, + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "drilldown" : "Jorg Sommrey", + "y" : 3, + "name" : "Jorg Sommrey" + }, + { + "drilldown" : "Lance Wicks", + "y" : 1, + "name" : "Lance Wicks" + }, + { + "drilldown" : "Laurent Rosenfeld", + "y" : 6, + "name" : "Laurent Rosenfeld" + }, + { + "y" : 2, + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "name" : "Luca Ferrari", + "y" : 11, + "drilldown" : "Luca Ferrari" + }, + { + "y" : 1, + "drilldown" : "Mariano Spadaccini", + "name" : "Mariano Spadaccini" + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "drilldown" : "Matthew Neleigh", + "y" : 2, + "name" : "Matthew Neleigh" + }, + { + "name" : "Nelo Tovar", + "drilldown" : "Nelo Tovar", + "y" : 2 + }, + { + "drilldown" : "Packy Anderson", + "y" : 5, + "name" : "Packy Anderson" + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "y" : 2, + "drilldown" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "drilldown" : "Reinier Maliepaard", + "y" : 3, + "name" : "Reinier Maliepaard" + }, + { + "name" : "Robbie Hatley", + "y" : 3, + "drilldown" : "Robbie Hatley" + }, + { + "name" : "Robert Ransbottom", + "drilldown" : "Robert Ransbottom", + "y" : 2 + }, + { + "drilldown" : "Roger Bell_West", + "y" : 5, + "name" : "Roger Bell_West" + }, + { + "drilldown" : "Simon Green", + "y" : 3, + "name" : "Simon Green" + }, + { + "y" : 4, + "drilldown" : "Thomas Kohler", + "name" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "y" : 4, + "drilldown" : "Ulrich Rieke" + }, + { + "name" : "W. Luis Mochan", + "y" : 3, + "drilldown" : "W. Luis Mochan" + }, + { + "y" : 2, + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc" + } + ], + "name" : "The Weekly Challenge - 262" + } + ], + "drilldown" : { + "series" : [ + { + "name" : "Adam Russell", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Adam Russell" + }, + { + "name" : "Ali Moradi", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Ali Moradi" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Andrew Shitov", + "id" : "Andrew Shitov" + }, + { + "id" : "Arne Sommer", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Arne Sommer" + }, + { + "id" : "Asher Harvey-Smith", + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Asher Harvey-Smith" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "name" : "Athanasius", + "id" : "Athanasius" + }, + { + "id" : "BarrOff", + "name" : "BarrOff", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Bob Lied", + "id" : "Bob Lied" + }, + { + "id" : "Bruce Gray", + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Bruce Gray" + }, + { + "id" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "id" : "Dave Jacoby", + "name" : "Dave Jacoby", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "id" : "David Ferrone", + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "E. Choroba", + "id" : "E. Choroba" + }, + { + "name" : "Feng Chang", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Feng Chang" + }, + { + "id" : "Jan Krnavek", + "name" : "Jan Krnavek", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "name" : "Lance Wicks", + "id" : "Lance Wicks" + }, + { + "id" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Laurent Rosenfeld" + }, + { + "id" : "Lubos Kolouch", + "name" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Luca Ferrari", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 9 + ] + ], + "id" : "Luca Ferrari" + }, + { + "id" : "Mariano Spadaccini", + "data" : [ + [ + "Perl", + 1 + ] + ], + "name" : "Mariano Spadaccini" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Mark Anderson", + "id" : "Mark Anderson" + }, + { + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Nelo Tovar", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Nelo Tovar" + }, + { + "id" : "Packy Anderson", + "name" : "Packy Anderson", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Peter Campbell Smith", + "id" : "Peter Campbell Smith" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Peter Meszaros", + "id" : "Peter Meszaros" + }, + { + "id" : "Reinier Maliepaard", + "name" : "Reinier Maliepaard", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "id" : "Robbie Hatley", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Robbie Hatley" + }, + { + "name" : "Robert Ransbottom", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Robert Ransbottom" + }, + { + "id" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Roger Bell_West" + }, + { + "name" : "Simon Green", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Simon Green" + }, + { + "name" : "Thomas Kohler", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Thomas Kohler" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "name" : "Ulrich Rieke", + "id" : "Ulrich Rieke" + }, + { + "id" : "W. Luis Mochan", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "W. Luis Mochan" + }, + { + "id" : "Wanderdoc", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Wanderdoc" + } + ] + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "subtitle" : { + "text" : "[Champions: 36] Last updated at 2024-04-01 17:07:54 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 262" + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 1df091328d..0daf64f3fb 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,156 +1,39 @@ { - "legend" : { - "enabled" : 0 - }, - "subtitle" : { - "text" : "[Champions: 36] Last updated at 2024-04-01 00:05:32 GMT" + "xAxis" : { + "type" : "category" }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "title" : { - "text" : "The Weekly Challenge - 262" - }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
", - "followPointer" : 1 - }, "series" : [ { - "colorByPoint" : 1, "data" : [ - { - "drilldown" : "Adam Russell", - "name" : "Adam Russell", - "y" : 2 - }, - { - "drilldown" : "Ali Moradi", - "name" : "Ali Moradi", - "y" : 3 - }, { "y" : 2, "drilldown" : "Andrew Shitov", "name" : "Andrew Shitov" }, - { - "y" : 3, - "drilldown" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { - "name" : "Asher Harvey-Smith", - "drilldown" : "Asher Harvey-Smith", - "y" : 2 - }, - { - "name" : "Athanasius", - "drilldown" : "Athanasius", - "y" : 4 - }, - { - "y" : 3, - "drilldown" : "BarrOff", - "name" : "BarrOff" - }, - { - "y" : 3, - "name" : "Bob Lied", - "drilldown" : "Bob Lied" - }, - { - "y" : 2, - "drilldown" : "Bruce Gray", - "name" : "Bruce Gray" - }, - { - "y" : 2, - "drilldown" : "Cheok-Yin Fung", - "name" : "Cheok-Yin Fung" - }, - { - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby", - "y" : 2 - }, - { - "y" : 2, - "name" : "David Ferrone", - "drilldown" : "David Ferrone" - }, - { - "drilldown" : "E. Choroba", - "name" : "E. Choroba", - "y" : 2 - }, { "name" : "Feng Chang", - "drilldown" : "Feng Chang", - "y" : 2 - }, - { "y" : 2, - "drilldown" : "Jan Krnavek", - "name" : "Jan Krnavek" + "drilldown" : "Feng Chang" }, { + "name" : "James Smith", "y" : 3, - "drilldown" : "Jorg Sommrey", - "name" : "Jorg Sommrey" - }, - { - "y" : 1, - "name" : "Lance Wicks", - "drilldown" : "Lance Wicks" + "drilldown" : "James Smith" }, { "name" : "Laurent Rosenfeld", "drilldown" : "Laurent Rosenfeld", - "y" : 6 + "y" : 3 }, { "y" : 2, - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch" - }, - { - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari", - "y" : 11 - }, - { - "drilldown" : "Mariano Spadaccini", - "name" : "Mariano Spadaccini", - "y" : 1 - }, - { - "name" : "Mark Anderson", "drilldown" : "Mark Anderson", - "y" : 2 - }, - { - "y" : 2, - "name" : "Matthew Neleigh", - "drilldown" : "Matthew Neleigh" - }, - { - "name" : "Nelo Tovar", - "drilldown" : "Nelo Tovar", - "y" : 2 - }, - { - "name" : "Packy Anderson", - "drilldown" : "Packy Anderson", - "y" : 5 - }, - { - "y" : 3, - "drilldown" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith" + "name" : "Mark Anderson" }, { "name" : "Peter Meszaros", @@ -158,130 +41,28 @@ "y" : 2 }, { - "y" : 3, - "drilldown" : "Reinier Maliepaard", - "name" : "Reinier Maliepaard" - }, - { - "drilldown" : "Robbie Hatley", - "name" : "Robbie Hatley", - "y" : 3 - }, - { - "name" : "Robert Ransbottom", - "drilldown" : "Robert Ransbottom", - "y" : 2 - }, - { - "y" : 5, - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West" - }, - { - "name" : "Simon Green", - "drilldown" : "Simon Green", - "y" : 3 - }, - { - "y" : 4, + "name" : "Thomas Kohler", "drilldown" : "Thomas Kohler", - "name" : "Thomas Kohler" - }, - { - "drilldown" : "Ulrich Rieke", - "name" : "Ulrich Rieke", "y" : 4 }, { - "y" : 3, "drilldown" : "W. Luis Mochan", + "y" : 3, "name" : "W. Luis Mochan" }, { - "y" : 2, "name" : "Wanderdoc", + "y" : 2, "drilldown" : "Wanderdoc" } ], - "name" : "The Weekly Challenge - 262" + "name" : "The Weekly Challenge - 263", + "colorByPoint" : 1 } ], "drilldown" : { "series" : [ { - "id" : "Adam Russell", - "name" : "Adam Russell", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "name" : "Ali Moradi", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Ali Moradi" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], - "name" : "Andrew Shitov", - "id" : "Andrew Shitov" - }, - { - "name" : "Arne Sommer", - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Arne Sommer" - }, - { - "id" : "Asher Harvey-Smith", - "name" : "Asher Harvey-Smith", - "data" : [ - [ - "Raku", - 2 - ] - ] - }, - { - "id" : "Athanasius", - "name" : "Athanasius", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ] - }, - { - "name" : "BarrOff", "data" : [ [ "Perl", @@ -289,97 +70,25 @@ ], [ "Raku", - 2 - ] - ], - "id" : "BarrOff" - }, - { - "id" : "Bob Lied", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", 1 ] ], - "name" : "Bob Lied" - }, - { - "id" : "Bruce Gray", - "name" : "Bruce Gray", - "data" : [ - [ - "Raku", - 2 - ] - ] - }, - { - "id" : "Cheok-Yin Fung", - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "Cheok-Yin Fung" - }, - { - "id" : "Dave Jacoby", - "name" : "Dave Jacoby", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "name" : "David Ferrone", - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "David Ferrone" - }, - { - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "E. Choroba", - "id" : "E. Choroba" + "name" : "Andrew Shitov", + "id" : "Andrew Shitov" }, { "id" : "Feng Chang", - "name" : "Feng Chang", - "data" : [ - [ - "Raku", - 2 - ] - ] - }, - { "data" : [ [ "Raku", 2 ] ], - "name" : "Jan Krnavek", - "id" : "Jan Krnavek" + "name" : "Feng Chang" }, { - "name" : "Jorg Sommrey", + "id" : "James Smith", + "name" : "James Smith", "data" : [ [ "Perl", @@ -389,70 +98,25 @@ "Blog", 1 ] - ], -