From ac0f1ea3cf12fe316d222dde948d8dacb5c84b99 Mon Sep 17 00:00:00 2001 From: Thomas Köhler Date: Mon, 25 Dec 2023 10:03:27 +0100 Subject: Add solution 249 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Köhler --- challenge-249/jeanluc2020/blog-1.txt | 1 + challenge-249/jeanluc2020/blog-2.txt | 1 + challenge-249/jeanluc2020/perl/ch-1.pl | 79 ++++++++++++++++++++++++++++++++ challenge-249/jeanluc2020/perl/ch-2.pl | 62 +++++++++++++++++++++++++ challenge-249/jeanluc2020/python/ch-1.py | 72 +++++++++++++++++++++++++++++ challenge-249/jeanluc2020/python/ch-2.py | 59 ++++++++++++++++++++++++ 6 files changed, 274 insertions(+) create mode 100644 challenge-249/jeanluc2020/blog-1.txt create mode 100644 challenge-249/jeanluc2020/blog-2.txt create mode 100755 challenge-249/jeanluc2020/perl/ch-1.pl create mode 100755 challenge-249/jeanluc2020/perl/ch-2.pl create mode 100755 challenge-249/jeanluc2020/python/ch-1.py create mode 100755 challenge-249/jeanluc2020/python/ch-2.py diff --git a/challenge-249/jeanluc2020/blog-1.txt b/challenge-249/jeanluc2020/blog-1.txt new file mode 100644 index 0000000000..7d29922b0c --- /dev/null +++ b/challenge-249/jeanluc2020/blog-1.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-249-1.html diff --git a/challenge-249/jeanluc2020/blog-2.txt b/challenge-249/jeanluc2020/blog-2.txt new file mode 100644 index 0000000000..1606e86db7 --- /dev/null +++ b/challenge-249/jeanluc2020/blog-2.txt @@ -0,0 +1 @@ +http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/perl/theweeklychallenge-249-2.html diff --git a/challenge-249/jeanluc2020/perl/ch-1.pl b/challenge-249/jeanluc2020/perl/ch-1.pl new file mode 100755 index 0000000000..fe6d982d7a --- /dev/null +++ b/challenge-249/jeanluc2020/perl/ch-1.pl @@ -0,0 +1,79 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-249/#TASK1 +# +# Task 1: Shortest Distance +# ========================= +# +# You are given an array of integers with even number of elements. +# +# Write a script to divide the given array into equal pairs such that: +# +# a) Each element belongs to exactly one pair. +# b) The elements present in a pair are equal. +# +# +## Example 1 +## +## Input: @ints = (3, 2, 3, 2, 2, 2) +## Output: (2, 2), (3, 3), (2, 2) +## +## There are 6 elements in @ints. +## They should be divided into 6 / 2 = 3 pairs. +## @ints is divided into the pairs (2, 2), (3, 3), and (2, 2) satisfying all the +## conditions. +# +## Example 2 +## +## Input: @ints = (1, 2, 3, 4) +## Output: () +## +## There is no way to divide @ints 2 pairs such that the pairs satisfy every +## condition. +# +############################################################ +## +## discussion +## +############################################################ +# +# We use the elements of the array as keys for a hash in which we +# count the amount of elements of this value in the array. +# If in the end, all values in the hash are even, we can spit out the +# correct number of arrays, otherwise we can only return an empty array. + +use strict; +use warnings; + +shortest_distance(3, 2, 3, 2, 2, 2); +shortest_distance(1, 2, 3, 4); + +sub shortest_distance { + my @ints = @_; + print "Input: (" . join(", ", @ints) . ")\n"; + my $map; + map { $map->{$_}++ } @ints; + my @result = (); + foreach my $key (keys %$map) { + if($map->{$key} % 2) { + print "Output: ()\n"; + return; + } + my $i = int( $map->{$key} / 2 ); + foreach my $elem (1..$i) { + push @result, [ $key, $key ]; + } + } + my $first = 1; + print "Output: "; + foreach my $elem (@result) { + if($first) { + $first = 0; + } else { + print ", "; + } + print "(" . join(", ", @$elem) . ")"; + } + print "\n"; +} + + diff --git a/challenge-249/jeanluc2020/perl/ch-2.pl b/challenge-249/jeanluc2020/perl/ch-2.pl new file mode 100755 index 0000000000..7407eaacbe --- /dev/null +++ b/challenge-249/jeanluc2020/perl/ch-2.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +# https://theweeklychallenge.org/blog/perl-weekly-challenge-249/#TASK2 +# +# Task 2: DI String Match +# ======================= +# +# You are given a string s, consisting of only the characters "D" and "I". +# +# Find a permutation of the integers [0 .. length(s)] such that for each +# character s[i] in the string: +# +# s[i] == 'I' ⇒ perm[i] < perm[i + 1] +# s[i] == 'D' ⇒ perm[i] > perm[i + 1] +# +## Example 1 +## +## Input: $str = "IDID" +## Output: (0, 4, 1, 3, 2) +# +## Example 2 +## +## Input: $str = "III" +## Output: (0, 1, 2, 3) +# +## Example 3 +## +## Input: $str = "DDI" +## Output: (3, 2, 0, 1) +# +############################################################ +## +## discussion +## +############################################################ +# +# We just count from 0 to length(s) for each "I" and from +# length(s) to 0 for each "D", and in the end add the last +# element we didn't use up yet. + +use strict; +use warnings; + +DI_string_match("IDID"); +DI_string_match("III"); +DI_string_match("DDI"); + +sub DI_string_match { + my $str = shift; + print "Input: '$str'\n"; + my $upper = length($str); + my $lower = 0; + my @result = (); + foreach my $char (split//,$str) { + if($char eq "I") { + push @result, $lower++; + } else { + push @result, $upper--; + } + } + push @result, $lower; + print "Output: (", join(", ", @result), ")\n"; +} diff --git a/challenge-249/jeanluc2020/python/ch-1.py b/challenge-249/jeanluc2020/python/ch-1.py new file mode 100755 index 0000000000..d187c0ca7d --- /dev/null +++ b/challenge-249/jeanluc2020/python/ch-1.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-249/#TASK1 +# +# Task 1: Shortest Distance +# ========================= +# +# You are given an array of integers with even number of elements. +# +# Write a script to divide the given array into equal pairs such that: +# +# a) Each element belongs to exactly one pair. +# b) The elements present in a pair are equal. +# +# +## Example 1 +## +## Input: @ints = (3, 2, 3, 2, 2, 2) +## Output: (2, 2), (3, 3), (2, 2) +## +## There are 6 elements in @ints. +## They should be divided into 6 / 2 = 3 pairs. +## @ints is divided into the pairs (2, 2), (3, 3), and (2, 2) satisfying all the +## conditions. +# +## Example 2 +## +## Input: @ints = (1, 2, 3, 4) +## Output: () +## +## There is no way to divide @ints 2 pairs such that the pairs satisfy every +## condition. +# +############################################################ +## +## discussion +## +############################################################ +# +# We use the elements of the array as keys for a hash in which we +# count the amount of elements of this value in the array. +# If in the end, all values in the hash are even, we can spit out the +# correct number of arrays, otherwise we can only return an empty array. + +def shortest_distance(ints: list) -> list: + print("Input: (", ", ".join([str(x) for x in ints]), ")") + result = [] + map = {} + for i in ints: + if i in map: + map[i] += 1 + else: + map[i] = 1 + for key in map.keys(): + if map[key] % 2 != 0: + print("Output: ()") + return () + i = int( map[key] / 2 ) + for j in range(1,i+1): + result.append( [key, key] ) + first = True + print("Output: ", end="") + for elem in result: + if first: + first = False + else: + print(", ", end="") + print(", ".join([str(x) for x in elem]), end="") + print("") + +shortest_distance([3, 2, 3, 2, 2, 2]) +shortest_distance([1, 2, 3, 4]) + diff --git a/challenge-249/jeanluc2020/python/ch-2.py b/challenge-249/jeanluc2020/python/ch-2.py new file mode 100755 index 0000000000..504e70a26d --- /dev/null +++ b/challenge-249/jeanluc2020/python/ch-2.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# https://theweeklychallenge.org/blog/perl-weekly-challenge-249/#TASK2 +# +# Task 2: DI String Match +# ======================= +# +# You are given a string s, consisting of only the characters "D" and "I". +# +# Find a permutation of the integers [0 .. length(s)] such that for each +# character s[i] in the string: +# +# s[i] == 'I' ⇒ perm[i] < perm[i + 1] +# s[i] == 'D' ⇒ perm[i] > perm[i + 1] +# +## Example 1 +## +## Input: $str = "IDID" +## Output: (0, 4, 1, 3, 2) +# +## Example 2 +## +## Input: $str = "III" +## Output: (0, 1, 2, 3) +# +## Example 3 +## +## Input: $str = "DDI" +## Output: (3, 2, 0, 1) +# +############################################################ +## +## discussion +## +############################################################ +# +# We just count from 0 to length(s) for each "I" and from +# length(s) to 0 for each "D", and in the end add the last +# element we didn't use up yet. + +def DI_string_match(string: str) -> list: + print("Input: '", string, "'", sep="") + upper = len(string) + lower = 0 + result = [] + for char in list(string): + if char == "I": + result.append(lower) + lower += 1 + else: + result.append(upper) + upper -= 1 + result.append(lower) + print("Output: (", ", ".join([str(x) for x in result]), ")") + return result + +DI_string_match("IDID"); +DI_string_match("III"); +DI_string_match("DDI"); + -- cgit From fe7c62233cb5309173a1f5744a522635f7448131 Mon Sep 17 00:00:00 2001 From: Michael Manring Date: Mon, 25 Dec 2023 23:05:34 +1100 Subject: pwc249 solution in python --- challenge-249/pokgopun/python/ch-1.py | 57 +++++++++++++++++++++++++++ challenge-249/pokgopun/python/ch-2.py | 73 +++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 challenge-249/pokgopun/python/ch-1.py create mode 100644 challenge-249/pokgopun/python/ch-2.py diff --git a/challenge-249/pokgopun/python/ch-1.py b/challenge-249/pokgopun/python/ch-1.py new file mode 100644 index 0000000000..cef9601557 --- /dev/null +++ b/challenge-249/pokgopun/python/ch-1.py @@ -0,0 +1,57 @@ +### https://theweeklychallenge.org/blog/perl-weekly-challenge-249/ +""" + +Task 1: Shortest Distance + +Submitted by: [66]Mohammad S Anwar + __________________________________________________________________ + + You are given an array of integers with even number of elements. + + Write a script to divide the given array into equal pairs such that: +a) Each element belongs to exactly one pair. +b) The elements present in a pair are equal. + +Example 1 + +Input: @ints = (3, 2, 3, 2, 2, 2) +Output: (2, 2), (3, 3), (2, 2) + +There are 6 elements in @ints. +They should be divided into 6 / 2 = 3 pairs. +@ints is divided into the pairs (2, 2), (3, 3), and (2, 2) satisfying all the co +nditions. + +Example 2 + +Input: @ints = (1, 2, 3, 4) +Output: () + +There is no way to divide @ints 2 pairs such that the pairs satisfy every condit +ion. + +Task 2: DI String Match +""" +### solution by pokgopun@gmail.com + +from itertools import chain + +def equalPairs(tup: tuple): + return tuple( + chain.from_iterable( + ( (e,e) for c in range(tup.count(e)//2 ) ) + for e in set(tup) + ) + ) + +import unittest + +class TestEqualPairs(unittest.TestCase): + def test1(self): + for inpt,otpt in { + (3, 2, 3, 2, 2, 2): ((2, 2), (3, 3), (2, 2)), + (1, 2, 3, 4): (), + }.items(): + self.assertEqual(sorted(equalPairs(inpt)),sorted(otpt)) + +unittest.main() diff --git a/challenge-249/pokgopun/python/ch-2.py b/challenge-249/pokgopun/python/ch-2.py new file mode 100644 index 0000000000..f535069d2e --- /dev/null +++ b/challenge-249/pokgopun/python/ch-2.py @@ -0,0 +1,73 @@ +### https://theweeklychallenge.org/blog/perl-weekly-challenge-249/ +""" + +Task 2: DI String Match + +Submitted by: [67]Mohammad S Anwar + __________________________________________________________________ + + You are given a string s, consisting of only the characters "D" and + "I". + + Find a permutation of the integers [0 .. length(s)] such that for each + character s[i] in the string: +s[i] == 'I' ⇒ perm[i] < perm[i + 1] +s[i] == 'D' ⇒ perm[i] > perm[i + 1] + +Example 1 + +Input: $str = "IDID" +Output: (0, 4, 1, 3, 2) + +Example 2 + +Input: $str = "III" +Output: (0, 1, 2, 3) + +Example 3 + +Input: $str = "DDI" +Output: (3, 2, 0, 1) + __________________________________________________________________ + + Last date to submit the solution 23:59 (UK Time) Sunday 31st December + 2023. + __________________________________________________________________ + +SO WHAT DO YOU THINK ? +""" +### solution by pokgopun@gmail.com + +from itertools import permutations + +def dism(s: str): + t = tuple() + l = len(s) + for perm in permutations(tuple(range(l+1)),l+1): + #print(perm) + for i in range(l): + #print(f"{s[i]},{perm[i]},{perm[i+1]}") + if s[i]=="I": + if perm[i] >= perm[i+1]: + break + elif s[i]=="D": + if perm[i] <= perm[i+1]: + break + else: + #print("=>",perm) + t += (perm,) + #print(t) + return t + +import unittest + +class TestDism(unittest.TestCase): + def test(self): + for inpt,otpt in { + "IDID": (0, 4, 1, 3, 2), + "III": (0, 1, 2, 3), + "DDI": (3, 2, 0, 1), + }.items(): + self.assertEqual(dism(inpt).count(otpt)>0,True) + +unittest.main() -- cgit From 06399d1731e8a64bc5d5f4070e96c218dc3212ce Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 25 Dec 2023 12:20:55 +0000 Subject: Challenge 249 Solutions (Raku) --- challenge-249/mark-anderson/raku/ch-1.raku | 12 ++++++++++++ challenge-249/mark-anderson/raku/ch-2.raku | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 challenge-249/mark-anderson/raku/ch-1.raku create mode 100644 challenge-249/mark-anderson/raku/ch-2.raku diff --git a/challenge-249/mark-anderson/raku/ch-1.raku b/challenge-249/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..d3b772effb --- /dev/null +++ b/challenge-249/mark-anderson/raku/ch-1.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku +use Test; + +is-deeply equal-pairs(3,2,3,2,2,2), ((2,2),(2,2),(3,3)); +nok equal-pairs(1,2,3,4); + +sub equal-pairs(+@a where * %% 2) +{ + my $b = @a.Bag; + return False unless all($b.values) %% 2; + $b.kxxv.sort.rotor(2) +} diff --git a/challenge-249/mark-anderson/raku/ch-2.raku b/challenge-249/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..c1d73452a2 --- /dev/null +++ b/challenge-249/mark-anderson/raku/ch-2.raku @@ -0,0 +1,22 @@ +#!/usr/bin/env raku +use Test; + +is-deeply DI("IDID"), (0,4,1,3,2); +is-deeply DI("III"), (0,1,2,3); +is-deeply DI("DDI"), (3,2,0,1); +is-deeply DI("DDID"), (4,3,0,2,1); +is-deeply DI("IDDID"), (0,5,4,1,3,2); +is-deeply DI("DDD"), (3,2,1,0); +is-deeply DI("IDDIIDIIIDIIDDIDIDDI"), (0,20,19,1,2,18,3,4,5,17,6,7,16,15,8,14,9,13,12,10,11); + +sub DI($str) +{ + my @a = flat $str.comb, "I"; + my %h := { :I(0), :D(@a.end) } + + gather while @a.shift -> $a + { + take %h{$a}.abs; + %h{$a}-- + } +} -- cgit From 6fe6b26d3e03f849c61d1425968b68d2e0ab4d31 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 25 Dec 2023 12:25:40 +0000 Subject: Challenge 249 Solutions (Raku) --- challenge-249/mark-anderson/raku/ch-1.raku | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-249/mark-anderson/raku/ch-1.raku b/challenge-249/mark-anderson/raku/ch-1.raku index d3b772effb..8b84602374 100644 --- a/challenge-249/mark-anderson/raku/ch-1.raku +++ b/challenge-249/mark-anderson/raku/ch-1.raku @@ -2,11 +2,11 @@ use Test; is-deeply equal-pairs(3,2,3,2,2,2), ((2,2),(2,2),(3,3)); -nok equal-pairs(1,2,3,4); +is-deeply equal-pairs(1,2,3,4), (); sub equal-pairs(+@a where * %% 2) { my $b = @a.Bag; - return False unless all($b.values) %% 2; + return () unless all($b.values) %% 2; $b.kxxv.sort.rotor(2) } -- cgit From 18fe1cc9bbde79fa195f77c4806e1cb69a8d0501 Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 25 Dec 2023 12:33:37 +0000 Subject: Challenge 249 Solutions (Raku) --- challenge-249/mark-anderson/raku/ch-1.raku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-249/mark-anderson/raku/ch-1.raku b/challenge-249/mark-anderson/raku/ch-1.raku index 8b84602374..992e315b1d 100644 --- a/challenge-249/mark-anderson/raku/ch-1.raku +++ b/challenge-249/mark-anderson/raku/ch-1.raku @@ -8,5 +8,5 @@ sub equal-pairs(+@a where * %% 2) { my $b = @a.Bag; return () unless all($b.values) %% 2; - $b.kxxv.sort.rotor(2) + $b.kxxv.sort.batch(2) } -- cgit From 413aea80198685a15518411388b4ae622dad5cfb Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 25 Dec 2023 12:48:52 +0000 Subject: Challenge 249 Solutions (Raku) --- challenge-249/mark-anderson/raku/ch-1.raku | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-249/mark-anderson/raku/ch-1.raku b/challenge-249/mark-anderson/raku/ch-1.raku index 992e315b1d..8adcd9f766 100644 --- a/challenge-249/mark-anderson/raku/ch-1.raku +++ b/challenge-249/mark-anderson/raku/ch-1.raku @@ -8,5 +8,5 @@ sub equal-pairs(+@a where * %% 2) { my $b = @a.Bag; return () unless all($b.values) %% 2; - $b.kxxv.sort.batch(2) + $b.kxxv.batch(2).sort } -- cgit From 25544ece2cc3a152d5e91b0971fec10538b72b56 Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Mon, 25 Dec 2023 16:43:17 +0100 Subject: Add solutions to 249: Equal Pairs & DI String Match by E. Choroba --- challenge-249/e-choroba/perl/ch-1.pl | 75 ++++++++++++++++++++++++++++++++++++ challenge-249/e-choroba/perl/ch-2.pl | 53 +++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100755 challenge-249/e-choroba/perl/ch-1.pl create mode 100755 challenge-249/e-choroba/perl/ch-2.pl diff --git a/challenge-249/e-choroba/perl/ch-1.pl b/challenge-249/e-choroba/perl/ch-1.pl new file mode 100755 index 0000000000..41f1d964ab --- /dev/null +++ b/challenge-249/e-choroba/perl/ch-1.pl @@ -0,0 +1,75 @@ +#!/usr/bin/perl +use warnings; +use strict; +use experimental qw( signatures ); + +sub equal_pairs_count(@ints) { + my %seen; + ++$seen{$_} for @ints; + return [map $seen{$_} % 2 ? return [] + : ([$_, $_]) x ($seen{$_} / 2), + keys %seen] +} + +sub equal_pairs_odd(@ints) { + my %odd; + my @pairs; + for my $i (@ints) { + if (exists $odd{$i}) { + delete $odd{$i}; + push @pairs, [$i, $i]; + } else { + undef $odd{$i}; + } + } + return keys %odd ? [] : \@pairs +} + + +use Test2::V0 -srand => srand; +plan 2 + 1; + +my $type = 'count'; +*equal_pairs = *equal_pairs_count{CODE}; +for (1, 2) { + subtest $type => sub { + plan 5; + + is equal_pairs(3, 2, 3, 2, 2, 2), + bag { item $_ for [2, 2], [2, 2], [3, 3]; }, + 'Example 1'; + + is equal_pairs(1, 2, 3, 4), [], 'Example 2'; + + + is equal_pairs(-1, -1, -2, -2), + bag { item $_ for [-1, -1], [-2, -2]; }, + 'Negative numbers'; + + is equal_pairs(1, 1, 1, 1, 2, 2, 2, 2), + bag { item $_ for [1, 1], [1, 1], [2, 2], [2, 2]; }, + 'More than once'; + + is equal_pairs(1, 1, 1, 1, 2, 2, 2, 2, 1), + [], + 'More than once odd'; + }; + + no warnings 'redefine'; + $type = 'odd'; + *equal_pairs = *equal_pairs_odd{CODE}; +} + +use Benchmark qw{ cmpthese }; + +my @l = map int rand 1000, 1 .. 100_000; +is equal_pairs_odd(@l), equal_pairs_count(@l), 'same'; +cmpthese(-3, { + odd => sub { equal_pairs_odd(@l) }, + count => sub { equal_pairs_count(@l) }, +}); + +__END__ + Rate odd count +odd 9.97/s -- -82% +count 55.5/s 456% -- diff --git a/challenge-249/e-choroba/perl/ch-2.pl b/challenge-249/e-choroba/perl/ch-2.pl new file mode 100755 index 0000000000..e498008452 --- /dev/null +++ b/challenge-249/e-choroba/perl/ch-2.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl +use warnings; +use strict; +use feature qw{ say }; + +use Test2::V0; +use experimental qw( signatures ); + +sub DI_string_match($str) { + my @p = (0); + my $max = 1; + my %DISPATCH = (I => sub { + push @p, $max++; + }, + D => sub { + $_++ for @p, $max; + push @p, 0; + }); + $DISPATCH{$_}() for split //, $str; + return \@p +} + +{ my %DISPATCH = (D => sub($perm, $i) { $perm->[$i - 1] > $perm->[$i] }, + I => sub($perm, $i) { $perm->[$i - 1] < $perm->[$i] }); + sub matches($s, $perm) { + return unless @$perm - 1 == length $s; + my %used; + @used{@$perm} = (); + exists $used{$_} or return for 0 .. length $s; + + for my $i (1 .. length $s) { + my $char = substr $s, $i - 1, 1; + return unless $DISPATCH{$char}($perm, $i); + } + return 1 + } +} + +plan 3 + 5 + 3; + +is matches('IDID', [0, 4, 1, 3, 2]), 1, 'matches() correct for Example 1'; +is matches('III', [0, 1, 2, 3]), 1, 'matches() correct for Example 2'; +is matches('DDI', [3, 2, 0, 1]), 1, 'matches() correct for Example 3'; + +is matches('I', [1, 0]), undef, 'matches() detects wrong order'; +is matches('D', [0, 1]), undef, 'matches() detects wrong order'; +is matches('I', [0, 2]), undef, 'matches() checks the range'; +is matches('III', [0, 1, 2]), undef, 'matches() rejects shorter'; +is matches('III', [0, 1, 2, 3, 4]), undef, 'matches() rejects longer'; + +is matches('IDID', DI_string_match('IDID')), 1, 'Example 1'; +is matches('III', DI_string_match('III')), 1, 'Example 2'; +is matches('DDI', DI_string_match('DDI')), 1, 'Example 3'; -- cgit From 993b8be6de0c326497f7cd7d51e1c4f6664fb2a1 Mon Sep 17 00:00:00 2001 From: "E. Choroba" Date: Mon, 25 Dec 2023 16:45:16 +0100 Subject: Add Python solutions to 249 by E. Choroba --- challenge-249/e-choroba/python/ch-1.py | 20 ++++++++++++++++++++ challenge-249/e-choroba/python/ch-2.py | 23 +++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 challenge-249/e-choroba/python/ch-1.py create mode 100755 challenge-249/e-choroba/python/ch-2.py diff --git a/challenge-249/e-choroba/python/ch-1.py b/challenge-249/e-choroba/python/ch-1.py new file mode 100755 index 0000000000..8804c18a26 --- /dev/null +++ b/challenge-249/e-choroba/python/ch-1.py @@ -0,0 +1,20 @@ +#! /usr/bin/python3 +from collections import Counter + +def equal_pairs(*ints): + seen = Counter(ints) + pairs = [] + for c in seen: + if seen[c] % 2 == 1: + return [] + else: + pairs += map(lambda _i: [c, c], range(seen[c] // 2)) + return pairs + +assert equal_pairs(3, 2, 3, 2, 2, 2) == [[3, 3], [2, 2], [2, 2]], 'Example 1' +assert equal_pairs(1, 2, 3, 4) == [], 'Example 2' +assert equal_pairs(-1, -1, -2, -2) == [[-1, -1], [-2, -2]], 'Negative numbers' +assert equal_pairs(1, 1, 1, 1, 2, 2, 2, 2) == [ + [1, 1], [1, 1], [2, 2], [2, 2]], \ + 'More than once' +assert equal_pairs(1, 1, 1, 1, 2, 2, 2, 2, 1) == [], 'More than once odd'; diff --git a/challenge-249/e-choroba/python/ch-2.py b/challenge-249/e-choroba/python/ch-2.py new file mode 100755 index 0000000000..9cff6bee20 --- /dev/null +++ b/challenge-249/e-choroba/python/ch-2.py @@ -0,0 +1,23 @@ +#! /usr/bin/python3 +class DiStringMatch: + def __init__(self): + self.p = [0] + self.mx = 1 + + def process(self, s): + def inc(): + self.p.append(self.mx) + self.mx += 1 + + def dec(): + self.p = [x + 1 for x in self.p] + self.mx += 1 + self.p.append(0) + + for ch in s: + inc() if ch == 'I' else dec() + return self.p + +assert DiStringMatch().process('IDID') == [2, 3, 1, 4, 0] +assert DiStringMatch().process('III') == [0, 1, 2, 3] +assert DiStringMatch().process('DDI') == [2, 1, 0, 3] -- cgit From 8dde5fc3043bfad8ad700801206b460b0d52e59c Mon Sep 17 00:00:00 2001 From: pme Date: Mon, 25 Dec 2023 21:52:28 +0100 Subject: challenge-249 --- challenge-249/peter-meszaros/perl/ch-1.pl | 68 ++++++++++++++++++++++++ challenge-249/peter-meszaros/perl/ch-2.pl | 86 +++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100755 challenge-249/peter-meszaros/perl/ch-1.pl create mode 100755 challenge-249/peter-meszaros/perl/ch-2.pl diff --git a/challenge-249/peter-meszaros/perl/ch-1.pl b/challenge-249/peter-meszaros/perl/ch-1.pl new file mode 100755 index 0000000000..0caeece62f --- /dev/null +++ b/challenge-249/peter-meszaros/perl/ch-1.pl @@ -0,0 +1,68 @@ +#!/usr/bin/env perl +# +# You are given an array of integers with even number of elements. +# +# Write a script to divide the given array into equal pairs such that: +# +# a) Each element belongs to exactly one pair. +# b) The elements present in a pair are equal. +# +# Example 1 +# +# Input: @ints = (3, 2, 3, 2, 2, 2) +# Output: (2, 2), (3, 3), (2, 2) +# +# There are 6 elements in @ints. +# They should be divided into 6 / 2 = 3 pairs. +# @ints is divided into the pairs (2, 2), (3, 3), and (2, 2) satisfying all the +# conditions. +# +# Example 2 +# +# Input: @ints = (1, 2, 3, 4) +# Output: () +# +# There is no way to divide @ints 2 pairs such that the pairs satisfy every +# condition. +# + +use strict; +use warnings; +use Test::More; +use Data::Dumper; +use Algorithm::Combinatorics qw/partitions/; + +my $cases = [ + [3, 2, 3, 2, 2, 2], + [1, 2, 3, 4], +]; + +sub equal_pairs +{ + my $l = shift; + + return undef if @$l % 2; + my @res; + my $len = @$l / 2; + my $iter = partitions($l, $len); + PARTITION: while (my $p = $iter->next) { + undef @res; + for (0..$len-1) { + my @tuple = $p->[$_]->@*; + next PARTITION unless @tuple == 2 and $tuple[0] == $tuple[1]; + push @res, \@tuple; + } + if (@res == $len ) { + @res = sort {$a->[0] <=> $b->[0]} @res; + last; + } + } + + return \@res; +} + +is_deeply(equal_pairs($cases->[0]), [[2, 2], [2, 2], [3, 3]], '[3, 2, 3, 2, 2, 2]'); +is_deeply(equal_pairs($cases->[1]), [] , '[1, 2, 3, 4]'); +done_testing(); + +exit 0; diff --git a/challenge-249/peter-meszaros/perl/ch-2.pl b/challenge-249/peter-meszaros/perl/ch-2.pl new file mode 100755 index 0000000000..9698c19525 --- /dev/null +++ b/challenge-249/peter-meszaros/perl/ch-2.pl @@ -0,0 +1,86 @@ +#!/usr/bin/env perl +# +# You are given a string s, consisting of only the characters "D" and "I". +# +# Find a permutation of the integers [0 .. length(s)] such that for each +# character s[i] in the string: +# +# s[i] == 'I' ⇒ perm[i] < perm[i + 1] +# s[i] == 'D' ⇒ perm[i] > perm[i + 1] +# +# Example 1 +# +# Input: $str = "IDID" +# Output: (0, 4, 1, 3, 2) +# +# Example 2 +# +# Input: $str = "III" +# Output: (0, 1, 2, 3) +# +# Example 3 +# +# Input: $str = "DDI" +# Output: (3, 2, 0, 1) +# + +use strict; +use warnings; +use Test::More; +use Data::Dumper; +use Algorithm::Combinatorics qw/permutations/; + +my $cases = [ + 'IDID', + 'III', + 'DDI', +]; + +sub di_string_match +{ + my $str = shift; + + my @str = split('', $str); + + my @res; + my $iter = permutations([0..length($str)]); + PERMUTATION: while (my $p = $iter->next) { + for my $i (0..$#str) { + next PERMUTATION unless $str[$i] eq 'I' and $p->[$i] < $p->[$i+1] or + $str[$i] eq 'D' and $p->[$i] > $p->[$i+1]; + } + push @res, $p; + } + @res = sort {join('-', @$a) cmp join('-', @$b)} @res; + + return \@res; +} + +is_deeply(di_string_match($cases->[0]), [[ 0, 2, 1, 4, 3 ], + [ 0, 3, 1, 4, 2 ], + [ 0, 3, 2, 4, 1 ], + [ 0, 4, 1, 3, 2 ], + [ 0, 4, 2, 3, 1 ], + [ 1, 2, 0, 4, 3 ], + [ 1, 3, 0, 4, 2 ], + [ 1, 3, 2, 4, 0 ], + [ 1, 4, 0, 3, 2 ], + [ 1, 4, 2, 3, 0 ], + [ 2, 3, 0, 4, 1 ], + [ 2, 3, 1, 4, 0 ], + [ 2, 4, 0, 3, 1 ], + [ 2, 4, 1, 3, 0 ], + [ 3, 4, 0, 2, 1 ], + [ 3, 4, 1, 2, 0 ], + ], 'IDID'); +is_deeply(di_string_match($cases->[1]), [[ 0, 1, 2, 3 ], + ], 'III'); +is_deeply(di_string_match($cases->[2]), [[ 2, 1, 0, 3 ], + [ 3, 1, 0, 2 ], + [ 3, 2, 0, 1 ], + ], 'DDI'); +done_testing(); + +exit 0; + + -- cgit From f52c911f9ada18fd83cda2b5651a63741b714e81 Mon Sep 17 00:00:00 2001 From: David Ferrone Date: Mon, 25 Dec 2023 16:00:51 -0500 Subject: Week 249 --- challenge-249/zapwai/perl/ch-1.pl | 23 +++++++++++++++++++++++ challenge-249/zapwai/perl/ch-2.pl | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 challenge-249/zapwai/perl/ch-1.pl create mode 100644 challenge-249/zapwai/perl/ch-2.pl diff --git a/challenge-249/zapwai/perl/ch-1.pl b/challenge-249/zapwai/perl/ch-1.pl new file mode 100644 index 0000000000..6550ba4305 --- /dev/null +++ b/challenge-249/zapwai/perl/ch-1.pl @@ -0,0 +1,23 @@ +use v5.30; +my @ints = (3, 2, 3, 2, 2, 2); +#my @ints = (1, 2, 3, 4); +say "Input: @ints"; +print "Output: "; +my %h; +$h{$_}++ for (@ints); +my $cnt = 0; +for my $k ( values %h ) { + if ($k % 2 != 0) { + say "()"; + last; + } else { + $cnt++; + } +} +if ($cnt == scalar keys %h) { + foreach my $k ( keys %h ) { + my $d = $h{$k} / 2; + print "($k, $k) " x $d; + } + print "\n"; +} diff --git a/challenge-249/zapwai/perl/ch-2.pl b/challenge-249/zapwai/perl/ch-2.pl new file mode 100644 index 0000000000..7b6c161aa9 --- /dev/null +++ b/challenge-249/zapwai/perl/ch-2.pl @@ -0,0 +1,34 @@ +use v5.30; +my $str = "IDID"; +# my $str = "III"; +# my $str = "DDI"; +my @s = split "", $str; +my @p = (0 .. @s); +say "Input: \$str = $str"; +print "Output: "; +my $cnt; +do { + $cnt = 0; + for my $i (0 .. $#s) { + if ($s[$i] eq 'I') { + if ($p[$i] > $p[$i+1]) { + swap($i, \@p); + $cnt++; + } + } else { + if ($p[$i] < $p[$i+1]) { + swap($i, \@p); + $cnt++; + } + } + } +} while ($cnt != 0); + +say "@p"; + +sub swap { + my ($i, $ref) = @_; + my $val = $$ref[$i]; + $$ref[$i] = $$ref[$i + 1]; + $$ref[$i + 1] = $val; +} -- cgit From 2fe9fe92abffa2fb01e876e42a07a8da80aacac9 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 25 Dec 2023 21:38:01 +0000 Subject: - Added solutions by Thomas Kohler. - Added solutions by PokGoPun. - Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by E. Choroba. - Added solutions by Peter Meszaros. - Added solutions by David Ferrone. - Added solutions by Eric Cheung. --- stats/pwc-challenge-248.json | 575 ++++++++++ stats/pwc-current.json | 555 ++-------- stats/pwc-language-breakdown-summary.json | 44 +- stats/pwc-language-breakdown.json | 1701 +++++++++++++++-------------- stats/pwc-leaders.json | 428 ++++---- stats/pwc-summary-1-30.json | 104 +- stats/pwc-summary-121-150.json | 100 +- stats/pwc-summary-151-180.json | 108 +- stats/pwc-summary-181-210.json | 58 +- stats/pwc-summary-211-240.json | 36 +- stats/pwc-summary-241-270.json | 104 +- stats/pwc-summary-271-300.json | 50 +- stats/pwc-summary-301-330.json | 30 +- stats/pwc-summary-31-60.json | 40 +- stats/pwc-summary-61-90.json | 24 +- stats/pwc-summary-91-120.json | 104 +- stats/pwc-summary.json | 670 ++++++------ 17 files changed, 2450 insertions(+), 2281 deletions(-) create mode 100644 stats/pwc-challenge-248.json diff --git a/stats/pwc-challenge-248.json b/stats/pwc-challenge-248.json new file mode 100644 index 0000000000..a94dcee6c6 --- /dev/null +++ b/stats/pwc-challenge-248.json @@ -0,0 +1,575 @@ +{ + "series" : [ + { + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 248", + "data" : [ + { + "y" : 5, + "drilldown" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { + "y" : 3, + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { + "y" : 4, + "name" : "Athanasius", + "drilldown" : "Athanasius" + }, + { + "y" : 2, + "drilldown" : "BarrOff", + "name" : "BarrOff" + }, + { + "y" : 2, + "drilldown" : "Bob Lied", + "name" : "Bob Lied" + }, + { + "drilldown" : "Bruce Gray", + "name" : "Bruce Gray", + "y" : 2 + }, + { + "y" : 2, + "name" : "Cheok-Yin Fung", + "drilldown" : "Cheok-Yin Fung" + }, + { + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby", + "y" : 3 + }, + { + "drilldown" : "David Ferrone", + "name" : "David Ferrone", + "y" : 2 + }, + { + "drilldown" : "E. Choroba", + "name" : "E. Choroba", + "y" : 2 + }, + { + "y" : 2, + "name" : "Joelle Maslak", + "drilldown" : "Joelle Maslak" + }, + { + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", + "y" : 3 + }, + { + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", + "y" : 6 + }, + { + "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch", + "y" : 5 + }, + { + "y" : 10, + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson", + "y" : 2 + }, + { + "drilldown" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "y" : 2 + }, + { + "drilldown" : "Nelo Tovar", + "name" : "Nelo Tovar", + "y" : 2 + }, + { + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke", + "y" : 2 + }, + { + "y" : 5, + "name" : "Packy Anderson", + "drilldown" : "Packy Anderson" + }, + { + "y" : 3, + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" + }, + { + "name" : "Peter Meszaros", + "drilldown" : "Peter Meszaros", + "y" : 2 + }, + { + "y" : 3, + "name" : "Robbie Hatley", + "drilldown" : "Robbie Hatley" + }, + { + "y" : 5, + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West" + }, + { + "y" : 3, + "name" : "Simon Green", + "drilldown" : "Simon Green" + }, + { + "y" : 3, + "name" : "Stephen G. Lynn", + "drilldown" : "Stephen G. Lynn" + }, + { + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler", + "y" : 4 + }, + { + "y" : 4, + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke" + }, + { + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan", + "y" : 3 + } + ] + } + ], + "subtitle" : { + "text" : "[Champions: 29] Last updated at 2023-12-25 21:31:44 GMT" + }, + "title" : { + "text" : "The Weekly Challenge - 248" + }, + "tooltip" : { + "followPointer" : 1, + "headerFormat" : "{series.name}
", + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "legend" : { + "enabled" : 0 + }, + "xAxis" : { + "type" : "category" + }, + "chart" : { + "type" : "column" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + } + } + }, + "drilldown" : { + "series" : [ + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Ali Moradi", + "id" : "Ali Moradi" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Arne Sommer", + "id" : "Arne Sommer" + }, + { + "name" : "Athanasius", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Athanasius" + }, + { + "name" : "BarrOff", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "id" : "BarrOff" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Bob Lied", + "id" : "Bob Lied" + }, + { + "name" : "Bruce Gray", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Bruce Gray" + }, + { + "id" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Dave Jacoby", + "id" : "Dave Jacoby" + }, + { + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "David Ferrone" + }, + { + "name" : "E. Choroba", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "E. Choroba" + }, + { + "id" : "Joelle Maslak", + "name" : "Joelle Maslak", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "id" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Jorg Sommrey" + }, + { + "name" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Laurent Rosenfeld" + }, + { + "name" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Lubos Kolouch" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 8 + ] + ], + "name" : "Luca Ferrari", + "id" : "Luca Ferrari" + }, + { + "id" : "Mark Anderson", + "name" : "Mark Anderson", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "id" : "Matthew Neleigh", + "name" : "Matthew Neleigh", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "id" : "Nelo Tovar", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Nelo Tovar" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Niels van Dijke", + "id" : "Niels van Dijke" + }, + { + "id" : "Packy Anderson", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Packy Anderson" + }, + { + "id" : "Peter Campbell Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Peter Campbell Smith" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Peter Meszaros", + "id" : "Peter Meszaros" + }, + { + "id" : "Robbie Hatley", + "name" : "Robbie Hatley", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "name" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Roger Bell_West" + }, + { + "id" : "Simon Green", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Simon Green" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Stephen G. Lynn", + "id" : "Stephen G. Lynn" + }, + { + "name" : "Thomas Kohler", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Ulrich Rieke" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "W. Luis Mochan", + "id" : "W. Luis Mochan" + } + ] + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 069bb17420..114c7bdd6d 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,11 +1,63 @@ { + "series" : [ + { + "name" : "The Weekly Challenge - 249", + "colorByPoint" : 1, + "data" : [ + { + "name" : "David Ferrone", + "y" : 2, + "drilldown" : "David Ferrone" + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler", + "y" : 4 + }, + { + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan", + "y" : 3 + } + ] + } + ], + "legend" : { + "enabled" : 0 + }, "tooltip" : { + "headerFormat" : "{series.name}
", "followPointer" : 1, - "pointFormat" : "{point.name}: {point.y:f}
", - "headerFormat" : "{series.name}
" + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "title" : { - "text" : "The Weekly Challenge - 248" + "text" : "The Weekly Challenge - 249" + }, + "subtitle" : { + "text" : "[Champions: 6] Last updated at 2023-12-25 21:34:50 GMT" }, "drilldown" : { "series" : [ @@ -14,222 +66,14 @@ [ "Perl", 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 ] ], - "id" : "Ali Moradi", - "name" : "Ali Moradi" - }, - { - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Arne Sommer", - "name" : "Arne Sommer" - }, - { - "name" : "Athanasius", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "id" : "Athanasius" - }, - { - "id" : "BarrOff", - "data" : [ - [ - "Perl", - 1 - ], - [ - "Raku", - 1 - ] - ], - "name" : "BarrOff" - }, - { - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "Bob Lied", - "name" : "Bob Lied" - }, - { - "name" : "Bruce Gray", - "id" : "Bruce Gray", - "data" : [ - [ - "Raku", - 2 - ] - ] - }, - { - "name" : "Cheok-Yin Fung", - "id" : "Cheok-Yin Fung", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "name" : "Dave Jacoby", - "id" : "Dave Jacoby", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { "id" : "David Ferrone", - "data" : [ - [ - "Perl", - 2 - ] - ], "name" : "David Ferrone" }, { + "name" : "E. Choroba", "id" : "E. Choroba", - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "E. Choroba" - }, - { - "name" : "Joelle Maslak", - "id" : "Joelle Maslak", - "data" : [ - [ - "Raku", - 2 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey" - }, - { - "name" : "Laurent Rosenfeld", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 2 - ] - ], - "id" : "Laurent Rosenfeld" - }, - { - "id" : "Lubos Kolouch", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "name" : "Lubos Kolouch" - }, - { - "name" : "Luca Ferrari", - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 8 - ] - ], - "id" : "Luca Ferrari" - }, - { - "name" : "Mark Anderson", - "data" : [ - [ - "Raku", - 2 - ] - ], - "id" : "Mark Anderson" - }, - { - "id" : "Matthew Neleigh", - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "Matthew Neleigh" - }, - { - "name" : "Nelo Tovar", - "id" : "Nelo Tovar", "data" : [ [ "Perl", @@ -238,46 +82,14 @@ ] }, { - "name" : "Niels van Dijke", - "id" : "Niels van Dijke", "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 2 - ], [ "Raku", 2 - ], - [ - "Blog", - 1 ] ], - "id" : "Packy Anderson", - "name" : "Packy Anderson" - }, - { - "name" : "Peter Campbell Smith", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Peter Campbell Smith" + "id" : "Mark Anderson", + "name" : "Mark Anderson" }, { "name" : "Peter Meszaros", @@ -289,68 +101,9 @@ ] ] }, - { - "name" : "Robbie Hatley", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Robbie Hatley" - }, - { - "name" : "Roger Bell_West", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Roger Bell_West" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Simon Green", - "name" : "Simon Green" - }, - { - "name" : "Stephen G. Lynn", - "id" : "Stephen G. Lynn", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, { "id" : "Thomas Kohler", + "name" : "Thomas Kohler", "data" : [ [ "Perl", @@ -360,25 +113,9 @@ "Blog", 2 ] - ], - "name" : "Thomas Kohler" - }, - { - "id" : "Ulrich Rieke", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "name" : "Ulrich Rieke" + ] }, { - "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -389,177 +126,11 @@ 1 ] ], + "id" : "W. Luis Mochan", "name" : "W. Luis Mochan" } ] }, - "legend" : { - "enabled" : 0 - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 248", - "data" : [ - { - "y" : 5, - "drilldown" : "Ali Moradi", - "name" : "Ali Moradi" - }, - { - "drilldown" : "Arne Sommer", - "name" : "Arne Sommer", - "y" : 3 - }, - { - "drilldown" : "Athanasius", - "name" : "Athanasius", - "y" : 4 - }, - { - "y" : 2, - "name" : "BarrOff", - "drilldown" : "BarrOff" - }, - { - "y" : 2, - "name" : "Bob Lied", - "drilldown" : "Bob Lied" - }, - { - "y" : 2, - "name" : "Bruce Gray", - "drilldown" : "Bruce Gray" - }, - { - "y" : 2, - "name" : "Cheok-Yin Fung", - "drilldown" : "Cheok-Yin Fung" - }, - { - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby", - "y" : 3 - }, - { - "y" : 2, - "drilldown" : "David Ferrone", - "name" : "David Ferrone" - }, - { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "y" : 2, - "name" : "Joelle Maslak", - "drilldown" : "Joelle Maslak" - }, - { - "y" : 3, - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey" - }, - { - "name" : "Laurent Rosenfeld", - "drilldown" : "Laurent Rosenfeld", - "y" : 6 - }, - { - "y" : 5, - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch" - }, - { - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari", - "y" : 10 - }, - { - "y" : 2, - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson" - }, - { - "y" : 2, - "name" : "Matthew Neleigh", - "drilldown" : "Matthew Neleigh" - }, - { - "name" : "Nelo Tovar", - "drilldown" : "Nelo Tovar", - "y" : 2 - }, - { - "y" : 2, - "drilldown" : "Niels van Dijke", - "name" : "Niels van Dijke" - }, - { - "drilldown" : "Packy Anderson", - "name" : "Packy Anderson", - "y" : 5 - }, - { - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith", - "y" : 3 - }, - { - "y" : 2, - "name" : "Peter Meszaros", - "drilldown" : "Peter Meszaros" - }, - { - "name" : "Robbie Hatley", - "drilldown" : "Robbie Hatley", - "y" : 3 - }, - { - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West", - "y" : 5 - }, - { - "y" : 3, - "drilldown" : "Simon Green", - "name" : "Simon Green" - }, - { - "y" : 3, - "name" : "Stephen G. Lynn", - "drilldown" : "Stephen G. Lynn" - }, - { - "y" : 4, - "name" : "Thomas Kohler", - "drilldown" : "Thomas Kohler" - }, - { - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke", - "y" : 4 - }, - { - "drilldown" : "W. Luis Mochan", - "name" : "W. Luis Mochan", - "y" : 3 - } - ] - } - ], - "chart" : { - "type" : "column" - }, - "xAxis" : { - "type" : "category" - }, "plotOptions" : { "series" : { "borderWidth" : 0, @@ -569,7 +140,7 @@ } } }, - "subtitle" : { - "text" : "[Champions: 29] Last updated at 2023-12-25 00:31:21 GMT" + "chart" : { + "type" : "column" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 64b6438b59..32411b4b35 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,6 +1,9 @@ { - "subtitle" : { - "text" : "Last updated at 2023-12-25 00:31:21 GMT" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, "xAxis" : { "labels" : { @@ -11,53 +14,50 @@ }, "type" : "category" }, - "chart" : { - "type" : "column" + "legend" : { + "enabled" : "false" }, "series" : [ { "name" : "Contributions", "dataLabels" : { + "align" : "right", "format" : "{point.y:.0f}", + "rotation" : -90, + "y" : 10, "enabled" : "true", "color" : "#FFFFFF", - "y" : 10, - "rotation" : -90, "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "align" : "right" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } }, "data" : [ [ "Blog", - 4329 + 4332 ], [ "Perl", - 12800 + 12810 ], [ "Raku", - 7380 + 7382 ] ] } ], - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 + "tooltip" : { + "pointFormat" : "{point.y:.0f}" }, - "legend" : { - "enabled" : "false" + "chart" : { + "type" : "column" }, "title" : { "text" : "The Weekly Challenge Contributions [2019 - 2023]" }, - "tooltip" : { - "pointFormat" : "{point.y:.0f}" + "subtitle" : { + "text" : "Last updated at 2023-12-25 21:34:50 GMT" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 942500f775..ba04de28b9 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,12 +1,4 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "legend" : { - "enabled" : "false" - }, "drilldown" : { "series" : [ { @@ -28,8 +20,8 @@ "name" : "001" }, { - "name" : "002", "id" : "002", + "name" : "002", "data" : [ [ "Perl", @@ -46,8 +38,6