From 7d3dcb92a3d791f189a842c8bdc88dc1a5a6f3ec Mon Sep 17 00:00:00 2001 From: Adam Russell Date: Fri, 17 Nov 2023 13:26:22 -0500 Subject: initial commit --- challenge-224/adam-russell/perl/ch-1.pl | 26 ++++++++++++++++++++++++++ challenge-224/adam-russell/perl/ch-2.pl | 25 +++++++++++++++++++++++++ challenge-224/adam-russell/prolog/ch-1.p | 0 challenge-224/adam-russell/prolog/ch-2.p | 0 4 files changed, 51 insertions(+) create mode 100644 challenge-224/adam-russell/perl/ch-1.pl create mode 100644 challenge-224/adam-russell/perl/ch-2.pl create mode 100644 challenge-224/adam-russell/prolog/ch-1.p create mode 100644 challenge-224/adam-russell/prolog/ch-2.p diff --git a/challenge-224/adam-russell/perl/ch-1.pl b/challenge-224/adam-russell/perl/ch-1.pl new file mode 100644 index 0000000000..114db9238c --- /dev/null +++ b/challenge-224/adam-russell/perl/ch-1.pl @@ -0,0 +1,26 @@ +use v5.38; +## +# Given two strings $source and $target write a script to find out if +# using the characters (only once) from source a target string can be +# created. +## +use boolean; +sub special_notes{ + my($source, $target) = @_; + return special_notes_r([split //, $source], $target); +} + +sub special_notes_r{ + my($source, $target) = @_; + return true if $target eq q//; + return false if $target ne q// && @{$source} == 0; + my $c = pop @{$source}; + $target =~ s/$c//; + return special_notes_r($source, $target); +} + +MAIN:{ + say special_notes q/abc/, q/xyz/; + say special_notes q/scriptinglanguage/, q/perl/; + say special_notes q/aabbcc/, q/abc/; +} diff --git a/challenge-224/adam-russell/perl/ch-2.pl b/challenge-224/adam-russell/perl/ch-2.pl new file mode 100644 index 0000000000..60d7490799 --- /dev/null +++ b/challenge-224/adam-russell/perl/ch-2.pl @@ -0,0 +1,25 @@ +use v5.38; +## +# Given a string containing digits 0-9 only write a script to find out +# if the given string is additive number. An additive number is a +# string whose digits can form an additive sequence. +## +use Graph; +use boolean; +use Data::Dump q/pp/; +sub additive_number{ + my($digits) = @_; + my @numbers; + my $graph = Graph->new(); + do{ + my $i = $_; + $numbers[$i] = []; + push @{$numbers[$i]}, substr($digits, $i, $_) for 1 .. length($digits) - $i; + } for 0 .. length($digits) - 1; + my @last_numbers = map {pop @{$numbers[$_]}} 0 .. @numbers - 1; +} + +MAIN:{ + say additive_number 112358; + say additive_number 199100199; +} diff --git a/challenge-224/adam-russell/prolog/ch-1.p b/challenge-224/adam-russell/prolog/ch-1.p new file mode 100644 index 0000000000..e69de29bb2 diff --git a/challenge-224/adam-russell/prolog/ch-2.p b/challenge-224/adam-russell/prolog/ch-2.p new file mode 100644 index 0000000000..e69de29bb2 -- cgit From 8f247dd9b414bfd6f286667e91d13aee8b9575a0 Mon Sep 17 00:00:00 2001 From: Simon Green Date: Sun, 19 Nov 2023 17:50:52 +1100 Subject: Simon's solution to challenge 243 --- challenge-242/sgreen/README.md | 3 --- challenge-243/sgreen/README.md | 4 ++-- challenge-243/sgreen/blog.txt | 1 + challenge-243/sgreen/perl/ch-1.pl | 20 ++++++++++++++++++++ challenge-243/sgreen/perl/ch-2.pl | 20 ++++++++++++++++++++ challenge-243/sgreen/python/ch-1.py | 18 ++++++++++++++++++ challenge-243/sgreen/python/ch-2.py | 15 +++++++++++++++ 7 files changed, 76 insertions(+), 5 deletions(-) delete mode 100644 challenge-242/sgreen/README.md create mode 100644 challenge-243/sgreen/blog.txt create mode 100755 challenge-243/sgreen/perl/ch-1.pl create mode 100755 challenge-243/sgreen/perl/ch-2.pl create mode 100755 challenge-243/sgreen/python/ch-1.py create mode 100755 challenge-243/sgreen/python/ch-2.py diff --git a/challenge-242/sgreen/README.md b/challenge-242/sgreen/README.md deleted file mode 100644 index fbeb2f577f..0000000000 --- a/challenge-242/sgreen/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# The Weekly Challenge 241 - -Blog: [Triplets and Sorting](https://dev.to/simongreennet/similar-frequency-3i6b) diff --git a/challenge-243/sgreen/README.md b/challenge-243/sgreen/README.md index fbeb2f577f..e2f63d2857 100644 --- a/challenge-243/sgreen/README.md +++ b/challenge-243/sgreen/README.md @@ -1,3 +1,3 @@ -# The Weekly Challenge 241 +# The Weekly Challenge 243 -Blog: [Triplets and Sorting](https://dev.to/simongreennet/similar-frequency-3i6b) +Blog: [Weekly Challenge 243](https://dev.to/simongreennet/weekly-challenge-243-3ld) diff --git a/challenge-243/sgreen/blog.txt b/challenge-243/sgreen/blog.txt new file mode 100644 index 0000000000..3c217e63fe --- /dev/null +++ b/challenge-243/sgreen/blog.txt @@ -0,0 +1 @@ +https://dev.to/simongreennet/weekly-challenge-243-3ld \ No newline at end of file diff --git a/challenge-243/sgreen/perl/ch-1.pl b/challenge-243/sgreen/perl/ch-1.pl new file mode 100755 index 0000000000..d40db432ac --- /dev/null +++ b/challenge-243/sgreen/perl/ch-1.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use experimental 'signatures'; + +sub main (@ints) { + my $solutions = 0; + + while ( my ( $i, $value ) = each @ints ) { + # Find future values that are less than half the current value + $solutions += + scalar( grep { $value > $_ * 2 } @ints[ $i + 1 .. $#ints ] ); + } + + say $solutions; +} + +main(@ARGV); \ No newline at end of file diff --git a/challenge-243/sgreen/perl/ch-2.pl b/challenge-243/sgreen/perl/ch-2.pl new file mode 100755 index 0000000000..778a423841 --- /dev/null +++ b/challenge-243/sgreen/perl/ch-2.pl @@ -0,0 +1,20 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use experimental 'signatures'; + +use List::Util 'sum'; +use POSIX 'floor'; + +sub main (@ints) { + my $solution = 0; + foreach my $i (@ints) { + $solution += sum( map { floor( $i / $_ ) } @ints ); + } + + say $solution; +} + +main(@ARGV); \ No newline at end of file diff --git a/challenge-243/sgreen/python/ch-1.py b/challenge-243/sgreen/python/ch-1.py new file mode 100755 index 0000000000..56d72aa4f6 --- /dev/null +++ b/challenge-243/sgreen/python/ch-1.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import sys + + +def main(ints): + solutions = 0 + for i, value in enumerate(ints): + # Find future values that are less than half the current value + solutions += sum(1 for j in ints[i+1:] if value > 2 * j) + + print(solutions) + + +if __name__ == '__main__': + # Convert input into integers + array = [int(n) for n in sys.argv[1:]] + main(array) diff --git a/challenge-243/sgreen/python/ch-2.py b/challenge-243/sgreen/python/ch-2.py new file mode 100755 index 0000000000..5a3f723c7c --- /dev/null +++ b/challenge-243/sgreen/python/ch-2.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import math +import sys + + +def main(ints): + solution = sum(math.floor(i / j) for i in ints for j in ints) + print(solution) + + +if __name__ == '__main__': + # Convert input into integers + array = [int(n) for n in sys.argv[1:]] + main(array) -- cgit From 26703d5644f664d13bc0e2ff71be7bf422892a21 Mon Sep 17 00:00:00 2001 From: Jan Krňávek Date: Sun, 19 Nov 2023 11:25:27 +0100 Subject: solutions week 243 --- challenge-243/wambash/raku/ch-1.raku | 19 +++++++++++++++++++ challenge-243/wambash/raku/ch-2.raku | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 challenge-243/wambash/raku/ch-1.raku create mode 100644 challenge-243/wambash/raku/ch-2.raku diff --git a/challenge-243/wambash/raku/ch-1.raku b/challenge-243/wambash/raku/ch-1.raku new file mode 100644 index 0000000000..d79268a0fc --- /dev/null +++ b/challenge-243/wambash/raku/ch-1.raku @@ -0,0 +1,19 @@ +#!/usr/bin/env raku + +sub reverse-pairs (+nums) { + nums + andthen .combinations: 2 + andthen .grep: -> ($x, $y) { $x > 2 * $y }, :p + andthen .elems +} + +multi MAIN (Bool :test($)!) { + use Test; + is reverse-pairs(1,3,2,3,1),2; + is reverse-pairs(2, 4, 3, 5, 1), 3; + done-testing; +} + +multi MAIN (+nums) { + say reverse-pairs nums +} diff --git a/challenge-243/wambash/raku/ch-2.raku b/challenge-243/wambash/raku/ch-2.raku new file mode 100644 index 0000000000..b9d95d5c73 --- /dev/null +++ b/challenge-243/wambash/raku/ch-2.raku @@ -0,0 +1,18 @@ +#!/usr/bin/env raku + +sub floor-sum (+nums) { + [X,] nums xx 2 + andthen .map: -> ($x,$y) {$y div $x}\ + andthen .sum +} + +multi MAIN (Bool :test($)!) { + use Test; + is floor-sum(2,5,9),10; + is floor-sum(7 xx 7), 49; + done-testing; +} + +multi MAIN (+nums) { + say floor-sum nums +} -- cgit From 54f5e9b0b7956c918358d7113480049d85724ec1 Mon Sep 17 00:00:00 2001 From: Solathian Date: Sun, 19 Nov 2023 12:13:49 +0100 Subject: Added files for 243 --- challenge-243/solathian/perl/ch-1.pl | 30 ++++++++++++++++++++++++++++++ challenge-243/solathian/perl/ch-2.pl | 28 ++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 challenge-243/solathian/perl/ch-1.pl create mode 100644 challenge-243/solathian/perl/ch-2.pl diff --git a/challenge-243/solathian/perl/ch-1.pl b/challenge-243/solathian/perl/ch-1.pl new file mode 100644 index 0000000000..e577f69bd8 --- /dev/null +++ b/challenge-243/solathian/perl/ch-1.pl @@ -0,0 +1,30 @@ +#!usr/bin/perl +use v5.38; + +use builtin "indexed"; +no warnings "experimental"; + + +# Challenge 243 - 1 - Reverse Pairs +# You are given an array of integers. +# Write a script to return the number of reverse pairs in the given array. +# A reverse pair is a pair (i, j) where: a) 0 <= i < j < nums.length and b) nums[i] > 2 * nums[j]. + +revPair((1, 3, 2, 3, 1)); +revPair((2, 4, 3, 5, 1)); + +sub revPair(@arr) +{ + my @pairs; + + foreach my ($i, $iVal) (indexed @arr) + { + foreach my ($j, $jVal) (indexed @arr) + { + # just going with the debug approach, a simple counter would also suffice + push(@pairs, [$i, $j]) if( $i < $j and $iVal > 2*$jVal); + } + } + + say "Number of pairs: ", scalar @pairs; +} \ No newline at end of file diff --git a/challenge-243/solathian/perl/ch-2.pl b/challenge-243/solathian/perl/ch-2.pl new file mode 100644 index 0000000000..90b8d13b56 --- /dev/null +++ b/challenge-243/solathian/perl/ch-2.pl @@ -0,0 +1,28 @@ +#!usr/bin/perl +use v5.38; +use builtin "floor"; +no warnings "experimental"; + +# Challenge 243 - 2 - Floor Sum +# You are given an array of positive integers (>=1). +# Write a script to return the sum of floor(nums[i] / nums[j]) where 0 <= i,j < nums.length. +# The floor() function returns the integer part of the division. + + +floorSum(2, 5, 9); +floorSum(7, 7, 7, 7, 7, 7, 7); + +sub floorSum(@list) +{ + my $sum; + + foreach my ($iVal) (@list) + { + foreach my ($jVal) (@list) + { + $sum += floor($iVal / $jVal) + } + } + + say $sum; +} \ No newline at end of file -- cgit From 0517794ddd39ca5d18018c13461e4e724773c3e2 Mon Sep 17 00:00:00 2001 From: Humberto Massa Date: Sun, 19 Nov 2023 10:15:28 -0300 Subject: Oneliners as ever --- challenge-243/massa/raku/ch-1.raku | 66 +++++++++++++++++++++++++++++++++++++ challenge-243/massa/raku/ch-2.raku | 67 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 challenge-243/massa/raku/ch-1.raku create mode 100644 challenge-243/massa/raku/ch-2.raku diff --git a/challenge-243/massa/raku/ch-1.raku b/challenge-243/massa/raku/ch-1.raku new file mode 100644 index 0000000000..92be046bab --- /dev/null +++ b/challenge-243/massa/raku/ch-1.raku @@ -0,0 +1,66 @@ +#! /usr/bin/env raku + +# Perl Weekly Challenge +# © 2023 Shimon Bollinger. All rights reserved. +# Last modified: Mon 15 May 2023 09:17:32 PM EDT +# Version 0.0.1 + +=begin pod +=TITLE +=head2 Task 1: Reverse Pairs + +=SUBTITLE +=head2 Submitted by massa + +=CHALLENGE +=head2 + +You are given two arrays of integers. + +Write a script to return the number of reverse pairs in the given array. + +A reverse pair is a pair (i, j) where: a) 0 <= i < j < nums.length and b) +nums[i] > 2 * nums[j]. + +=head3 Example 1: + + Input: @nums = (1, 3, 2, 3, 1) + Output: 2 + + (1, 4) => nums[1] = 3, nums[4] = 1, 3 > 2 * 1 + (3, 4) => nums[3] = 3, nums[4] = 1, 3 > 2 * 1 + +=head3 Example 2: + + Input: @nums = (2, 4, 3, 5, 1) + Output: 3 + + (1, 4) => nums[1] = 4, nums[4] = 1, 4 > 2 * 1 + (2, 4) => nums[2] = 3, nums[4] = 1, 3 > 2 * 1 + (3, 4) => nums[3] = 5, nums[4] = 1, 5 > 2 * 1 + +=SOLUTION + +=end pod + +# always use the latest version of Raku +use v6.*; + +sub SOLUTION(@m) { + + @m.pairs.combinations(2).grep({.[0].value > 2 * .[1].value})».key +} + +multi MAIN (Bool :$test!) { + use Test; + + my @tests = + %{ input => (1, 3, 2, 3, 1), + output => (2,) }, + %{ input => (2, 4, 3, 5, 1), + output => (3,) }, + ; + + ..&SOLUTION.deepmap({$_}).&is-deeply: ., . for @tests +} # end of multi MAIN (Bool :$test!) + + diff --git a/challenge-243/massa/raku/ch-2.raku b/challenge-243/massa/raku/ch-2.raku new file mode 100644 index 0000000000..2899677d8b --- /dev/null +++ b/challenge-243/massa/raku/ch-2.raku @@ -0,0 +1,67 @@ +#! /usr/bin/env raku + +# Perl Weekly Challenge +# © 2023 Shimon Bollinger. All rights reserved. +# Last modified: Mon 15 May 2023 09:17:32 PM EDT +# Version 0.0.1 + +=begin pod +=TITLE +=head2 Task 2: Floor Sum + +=SUBTITLE +=head2 Submitted by massa + +=CHALLENGE +=head2 + +You are given an array of positive integers (>=1). + +Write a script to return the sum of floor(nums[i] / nums[j]) where 0 <= i,j < +nums.length. The floor() function returns the integer part of the division. + +=head3 Example 1: + + Input: @nums = (2, 5, 9) + Output: 10 + + floor(2 / 5) = 0 + floor(2 / 9) = 0 + floor(5 / 9) = 0 + floor(2 / 2) = 1 + floor(5 / 5) = 1 + floor(9 / 9) = 1 + floor(5 / 2) = 2 + floor(9 / 2) = 4 + floor(9 / 5) = 1 + +=head3 Example 2: + + Input: @nums = (7, 7, 7, 7, 7, 7, 7) + Output: 49 + +=SOLUTION + +=end pod + +# always use the latest version of Raku +use v6.*; + +sub SOLUTION(@_) { + [+] @_ Xdiv @_ +} + +multi MAIN (Bool :$test!) { + use Test; + + my @tests = + %{ input => (2, 5, 9), + output => (10,) }, + %{ input => (7, 7, 7, 7, 7, 7, 7), + output => (49,) }, + ; + + ..&SOLUTION.deepmap({$_}).&is-deeply: ., . for @tests +} # end of multi MAIN (Bool :$test!) + + -- cgit From b8213d8a2419c600934f77d65c5724b9f9864302 Mon Sep 17 00:00:00 2001 From: vinodk89 Date: Sun, 19 Nov 2023 22:04:17 +0530 Subject: Solution for Perl Weekly Challenge - Task#1 --- challenge-243/vinod-k/perl/ch-1.pl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-243/vinod-k/perl/ch-1.pl diff --git a/challenge-243/vinod-k/perl/ch-1.pl b/challenge-243/vinod-k/perl/ch-1.pl new file mode 100644 index 0000000000..86ef5ccf06 --- /dev/null +++ b/challenge-243/vinod-k/perl/ch-1.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my @a = (2, 4, 3, 5, 1); + +my $cnt = getReversePairs(@a); +print "Number of reverse pairs: $cnt\n"; + +sub getReversePairs { + my (@arr) = @_; + my $n = scalar @arr; + + my $count = 0; + my ($i, $j) = 0; + + for ($i = 0 ; $i < $n ; $i++) { + for ($j = $i + 1 ; $j < $n ; $j++) { + if ($arr[$i] > (2 * $arr[$j])) { + $count += 1; + } + } + } + return $count; +} -- cgit From 2cf3717673b538a185025a83df180b67aa25b72e Mon Sep 17 00:00:00 2001 From: Adam Russell Date: Sun, 19 Nov 2023 13:54:55 -0500 Subject: updated solutions --- challenge-224/adam-russell/perl/ch-2.pl | 42 +++++++++++++++++++++++++++++--- challenge-224/adam-russell/prolog/ch-1.p | 5 ++++ challenge-224/adam-russell/prolog/ch-2.p | 20 +++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/challenge-224/adam-russell/perl/ch-2.pl b/challenge-224/adam-russell/perl/ch-2.pl index 60d7490799..f0c518de25 100644 --- a/challenge-224/adam-russell/perl/ch-2.pl +++ b/challenge-224/adam-russell/perl/ch-2.pl @@ -4,19 +4,55 @@ use v5.38; # if the given string is additive number. An additive number is a # string whose digits can form an additive sequence. ## -use Graph; use boolean; -use Data::Dump q/pp/; +sub is_additive{ + my $additive = false; + { + my $i = @_ - 1; + my $x = $_[$i - 2]; + my $y = $_[$i - 1]; + my $last = pop @_; + return false if $last != $x + $y; + redo if @_ > 2; + } + return true; +} + sub additive_number{ my($digits) = @_; my @numbers; - my $graph = Graph->new(); do{ my $i = $_; $numbers[$i] = []; push @{$numbers[$i]}, substr($digits, $i, $_) for 1 .. length($digits) - $i; } for 0 .. length($digits) - 1; my @last_numbers = map {pop @{$numbers[$_]}} 0 .. @numbers - 1; + my $step = 0; + my @additive = map {[$_]} @last_numbers; + my @additive_temp; + { + @last_numbers = map {pop @{$numbers[$_]}} 0 .. @numbers - 1; + do{ + my $i = $_; + do{ + my $j = @{$additive[$i]}; + push @additive_temp, [$_, @{$additive[$i]}] if defined($_); + } for @last_numbers; + } for 0 .. @additive - 1; + $step++; + @additive = (); + if($step > 2){ + do{ + push @additive, $_ if is_additive @{$_}; + } for @additive_temp; + } + else{ + @additive = @additive_temp; + } + @additive_temp = (); + redo if 0 < grep { @{$_} > 0 } @numbers; + } + return boolean(@additive > 0); } MAIN:{ diff --git a/challenge-224/adam-russell/prolog/ch-1.p b/challenge-224/adam-russell/prolog/ch-1.p index e69de29bb2..ea709f500e 100644 --- a/challenge-224/adam-russell/prolog/ch-1.p +++ b/challenge-224/adam-russell/prolog/ch-1.p @@ -0,0 +1,5 @@ +special_notes(_, []). +special_notes(Source, Target):- + [H|S] = Source, + (select(H, Target, T); T = Target), + special_notes(S, T), !. diff --git a/challenge-224/adam-russell/prolog/ch-2.p b/challenge-224/adam-russell/prolog/ch-2.p index e69de29bb2..2ea7c5beca 100644 --- a/challenge-224/adam-russell/prolog/ch-2.p +++ b/challenge-224/adam-russell/prolog/ch-2.p @@ -0,0 +1,20 @@ +:-dynamic(path/2). + +substrings(S, Substrings):- + partial_substrings(S, Substrings). +partial_substrings([], []). +partial_substrings(S, Substrings):- + length(S, L), + findall(Prefix,( + between(1, L, K), + length(Prefix, K), + prefix(Prefix, S) + ), PartialSubstrings), + [_|TS] = S, + partial_substrings(TS, NextSubstrings), + Substrings = [PartialSubstrings|NextSubstrings]. + +additive_number(Number):- + substrings(Number, Substrings), + nl. + -- cgit From 60e02f7efd760ffdd7546176db0b3de9bead5f96 Mon Sep 17 00:00:00 2001 From: CY Fung Date: Mon, 20 Nov 2023 04:00:46 +0800 Subject: Week 243 --- challenge-243/cheok-yin-fung/perl/ch-1.pl | 19 +++++++++++++++++++ challenge-243/cheok-yin-fung/perl/ch-2.pl | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 challenge-243/cheok-yin-fung/perl/ch-1.pl create mode 100644 challenge-243/cheok-yin-fung/perl/ch-2.pl diff --git a/challenge-243/cheok-yin-fung/perl/ch-1.pl b/challenge-243/cheok-yin-fung/perl/ch-1.pl new file mode 100644 index 0000000000..bd99fce9c2 --- /dev/null +++ b/challenge-243/cheok-yin-fung/perl/ch-1.pl @@ -0,0 +1,19 @@ +# The Weekly Challenge 243 +# Task 1 Reverse Pairs +use v5.30.0; +use warnings; + +sub rp { + my @nums = @_; + my $ans = 0; + for my $j (reverse 1..$#nums) { + for my $i (0..$j-1) { + $ans++ if $nums[$i] > 2*$nums[$j]; + } + } + return $ans; +} + +use Test::More tests=>2; +ok rp(1,3,2,3,1) == 2; +ok rp(2,4,3,5,1) == 3; diff --git a/challenge-243/cheok-yin-fung/perl/ch-2.pl b/challenge-243/cheok-yin-fung/perl/ch-2.pl new file mode 100644 index 0000000000..d7148a55f2 --- /dev/null +++ b/challenge-243/cheok-yin-fung/perl/ch-2.pl @@ -0,0 +1,19 @@ +# The Weekly Challenge 243 +# Task 2 Floor Sum +use v5.30.0; +use warnings; + +sub fs { + my @nums = @_; + my $sum = 0; + for my $m (@nums) { + for my $n (@nums) { + $sum += int($m/$n); + } + } + return $sum; +} + +use Test::More tests=>2; +ok fs(2,5,9) == 10; +ok fs(7,7,7,7,7,7,7) == 49; -- cgit From 546103a0c143c6806af3910b229b069eab1e2791 Mon Sep 17 00:00:00 2001 From: Util Date: Sun, 19 Nov 2023 15:29:34 -0600 Subject: Add TWC 243 solutions by Bruce Gray (In Raku, and Javascript). --- challenge-243/bruce-gray/javascript/ch-1.js | 145 ++++++++++++++++++++++++++++ challenge-243/bruce-gray/javascript/ch-2.js | 54 +++++++++++ challenge-243/bruce-gray/raku/ch-1.raku | 16 +++ challenge-243/bruce-gray/raku/ch-2.raku | 32 ++++++ 4 files changed, 247 insertions(+) create mode 100644 challenge-243/bruce-gray/javascript/ch-1.js create mode 100644 challenge-243/bruce-gray/javascript/ch-2.js create mode 100644 challenge-243/bruce-gray/raku/ch-1.raku create mode 100644 challenge-243/bruce-gray/raku/ch-2.raku diff --git a/challenge-243/bruce-gray/javascript/ch-1.js b/challenge-243/bruce-gray/javascript/ch-1.js new file mode 100644 index 0000000000..3d798122d9 --- /dev/null +++ b/challenge-243/bruce-gray/javascript/ch-1.js @@ -0,0 +1,145 @@ +#!/usr/bin/env node +'use strict'; + +// Procedural, with manual accumulator +function task1a ( ns ) { + let ret = 0; + + for ( const [i, left] of ns.entries() ) + for ( const right of ns.slice(i+1) ) + if ( left > (right * 2) ) + ret++; + + return ret; +} + +// task1a, with inner loop (for&if) refactored to functional (filter&length). +function task1b ( ns ) { + let ret = 0; + for ( const [i, left] of ns.entries() ) { + ret += ns.slice(i+1).filter((right) => left > (right * 2)).length; + } + return ret; +} + +// task1b, with the filter expression extracted to a named local function. +function task1c ( ns ) { + let ret = 0; + for ( const [i, left] of ns.entries() ) { + + const is_reverse_pair = (right) => left > (right * 2); + + ret += ns.slice(i+1) + .filter(is_reverse_pair) + .length; + } + return ret; +} + +// task1c, with the outer loop refactored to .map(), and accumulator embedded in a .reduce(). +function task1d ( ns ) { + const add = (a, b) => a + b; + + const count_of_reverse_pairs_with_left = ([i, left]) => { + + const is_reverse_pair = (right) => left > (right * 2); + + return ns.slice(i+1) + .filter(is_reverse_pair) + .length; + } + + return [...ns.entries()].map( count_of_reverse_pairs_with_left ).reduce(add, 0); +} + +// Cannot use a faster .reduce directly on Iterator; experimental feature provided by Node. +function task1e ( ns ) { + const count_of_reverse_pairs_with_this_element = (accumumlator, [i, left]) => { + const is_reverse_pair = (right) => left > (right * 2); + + const count = ns.slice(i+1) + .filter(is_reverse_pair) + .length; + + return accumumlator + count; + } + + return [ ...ns.entries() ].reduce(count_of_reverse_pairs_with_this_element, 0); +} + +// task1d with map+reduce merged +function task1f ( ns ) { + // const add = (a, b) => a + b; + + const reverse_pairs = ([i, left]) => { + + const is_reverse_pair = (right) => left > (right * 2); + + return ns.slice(i+1) + .filter(is_reverse_pair) + .length; + } + const sum_reverse_pairs = (a, e) => a + reverse_pairs(e); + + return [ ...ns.entries() ].reduce(sum_reverse_pairs, 0); +} + +// pre-doubled once into a parallel `two_n` array, to reduce recalculations. +function task1g ( ns ) { + const two_n = ns.map( n => 2*n ); + + const reverse_pairs = ([i, left]) => { + + const is_reverse_pair = (right) => left > right; + + return two_n.slice(i+1) + .filter(is_reverse_pair) + .length; + } + const sum_reverse_pairs = (a, e) => a + reverse_pairs(e); + + return [ ...ns.entries() ].reduce(sum_reverse_pairs, 0); +} + +// Extracted "combinations" +function task1h ( ns ) { + const combinations_2 = (arr, func) => { + arr.forEach( (left,i) => { + arr.slice(i+1).map( (right) => func(left, right) ); + }); + } + + let count = 0; + const count_wanted = (L,R) => { if ( L > (R * 2) ) count++ }; + combinations_2(ns, count_wanted); + return count; +} + +const subs = [ + [ 'task1a', task1a ], + [ 'task1b', task1b ], + [ 'task1c', task1c ], + [ 'task1d', task1d ], + [ 'task1e', task1e ], + [ 'task1f', task1f ], + [ 'task1g', task1g ], + [ 'task1h', task1h ], +]; +const tests = [ + [ 2, [1, 3, 2, 3, 1], 'Example 1 from task' ], + [ 3, [2, 4, 3, 5, 1], 'Example 2 from task' ], + [ 0, [] , 'Null array' ], +]; +let test_number = 0; +function is ( got, expected, desc ) { + test_number++; + const ok_msg = (got === expected) ? "ok" : "not ok"; + const description = (typeof desc !== 'undefined') ? ` - ${desc}` : ''; + console.log(`${ok_msg} ${test_number}${description}`); +} +for ( const [ sub_name, task1_coderef ] of subs ) { + for ( const [ expected, input, test_name ] of tests ) { + const got = task1_coderef(input); + is( got, expected, `${sub_name}: ${test_name}`); + } +} diff --git a/challenge-243/bruce-gray/javascript/ch-2.js b/challenge-243/bruce-gray/javascript/ch-2.js new file mode 100644 index 0000000000..c5664a5c35 --- /dev/null +++ b/challenge-243/bruce-gray/javascript/ch-2.js @@ -0,0 +1,54 @@ +// Procedural +function task2a ( ns ) { + let ret = 0; + for ( const x of ns ) { + for ( const y of ns ) { + ret += Math.floor( x / y ); + } + } + return ret; +} + +// Functional, both using extracted code for Cartesian product. +const cartesian = + (...top_level_arrays) => top_level_arrays.reduce( + (accum, an_array) => accum.flatMap( + (element1) => an_array.map( + (element2) => [element1, element2].flat() +))); + +// .map(), then sum via .reduce . +function task2b (ns) { + return cartesian(ns, ns) + .map(([x,y]) => Math.floor(x/y)) + .reduce(((a,b) => a+b),0); +} + +// Do the summing *and* mapping during the .reduce . +const task2c = (ns) => cartesian(ns, ns).reduce(((a,[x,y]) => a+Math.floor(x/y)),0); + + + +let test_number = 0; +function is ( got, expected, desc ) { + test_number++; + const ok_msg = (got === expected) ? "ok" : "not ok"; + const description = (typeof desc !== 'undefined') ? ` - ${desc}` : ''; + console.log(`${ok_msg} ${test_number}${description}`); +} +const subs = [ + [ 'task2a', task2a ], + [ 'task2b', task2b ], + [ 'task2c', task2c ], +]; +const tests = [ + [ 10, [2, 5, 9] , 'Example 1 from task'], + [ 49, [7,7,7,7,7,7,7], 'Example 2 from task'], + [ 10, [2, 5, 9] , 'Null array'], +]; +for ( const [ sub_name, task2_coderef ] of subs ) { + for ( const [ expected, input, test_name ] of tests ) { + const got = task2_coderef(input); + is( got, expected, `${sub_name}: ${test_name}`); + } +} diff --git a/challenge-243/bruce-gray/raku/ch-1.raku b/challenge-243/bruce-gray/raku/ch-1.raku new file mode 100644 index 0000000000..fee01833c8 --- /dev/null +++ b/challenge-243/bruce-gray/raku/ch-1.raku @@ -0,0 +1,16 @@ +sub task1 ( @ns ) { + sub is_reverse_pair ( [$left, $right] ) { $left > ($right * 2) } + + return +grep &is_reverse_pair, + combinations(@ns, 2); +} + + +constant @tests = + ( 2, (1, 3, 2, 3, 1) ), + ( 3, (2, 4, 3, 5, 1) ), +; +use Test; plan +@tests; +for @tests -> ($expected, @ns) { + is task1(@ns), $expected; +} diff --git a/challenge-243/bruce-gray/raku/ch-2.raku b/challenge-243/bruce-gray/raku/ch-2.raku new file mode 100644 index 0000000000..b7d2751cab --- /dev/null +++ b/challenge-243/bruce-gray/raku/ch-2.raku @@ -0,0 +1,32 @@ +# Note that `div` can take the place of `floor after division` +# only because the task specifies integers. +# https://docs.raku.org/language/operators#infix_div +# https://docs.raku.org/language/operators#infix_X +# https://docs.raku.org/language/operators#Cross_metaoperators +sub task2_simple ( @ns ) { + return sum( @ns Xdiv @ns ); +} + +constant &task2_inscrutable = { [+] [Xdiv] @^ns xx 2 }; + +# For 10_000 element array (100 duplicates of a line of 100 random 2-digit numbers): +# 3 seconds for task2_faster, vs 42 seconds for &task2_simple. +sub task2_faster ( @ns ) { + my @p = @ns.Bag; + + return sum map { [*] |$_».value, |[div] $_».key }, ( @p X @p ); +} + + + +constant @subs = :&task2_simple, :&task2_inscrutable, :&task2_faster; +constant @tests = + ( 10, (2, 5, 9) ), + ( 49, (7, 7, 7, 7, 7, 7, 7) ), +; +use Test; plan +@subs * +@tests; +for @subs -> ( :key($sub_name), :value($task2) ) { + for @tests.kv -> $i, ($expected, @ns) { + is $task2.(@ns), $expected, "$sub_name.fmt('%-18s'): Example {$i+1}"; + } +} -- cgit From bbc9d0eba96994dbe80ceb3a69df3816cc60b09a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sun, 19 Nov 2023 22:11:35 +0000 Subject: - Added solutions by Simon Green. - Added solutions by Jan Krnavek. - Added solutions by Solathian. - Added solutions by Humberto Massa. - Added solutions by Vinod Kumar K. - Added solutions by Cheok-Yin Fung. - Added solutions by Bruce Gray. --- stats/pwc-current.json | 561 +++++---- stats/pwc-language-breakdown-summary.json | 42 +- stats/pwc-language-breakdown.json | 1546 +++++++++++------------ stats/pwc-leaders.json | 736 +++++------ stats/pwc-summary-1-30.json | 102 +- stats/pwc-summary-121-150.json | 38 +- stats/pwc-summary-151-180.json | 112 +- stats/pwc-summary-181-210.json | 102 +- stats/pwc-summary-211-240.json | 112 +- stats/pwc-summary-241-270.json | 58 +- stats/pwc-summary-271-300.json | 38 +- stats/pwc-summary-301-330.json | 42 +- stats/pwc-summary-31-60.json | 58 +- stats/pwc-summary-61-90.json | 42 +- stats/pwc-summary-91-120.json | 114 +- stats/pwc-summary.json | 1886 ++++++++++++++--------------- 16 files changed, 2849 insertions(+), 2740 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index a299fa8336..244af96c5e 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,191 +1,28 @@ { - "legend" : { - "enabled" : 0 + "title" : { + "text" : "The Weekly Challenge - 243" + }, + "xAxis" : { + "type" : "category" }, "chart" : { "type" : "column" }, "subtitle" : { - "text" : "[Champions: 30] Last updated at 2023-11-18 22:52:19 GMT" + "text" : "[Champions: 37] Last updated at 2023-11-19 22:09:07 GMT" }, - "xAxis" : { - "type" : "category" - }, - "series" : [ - { - "data" : [ - { - "drilldown" : "Ali Moradi", - "y" : 5, - "name" : "Ali Moradi" - }, - { - "drilldown" : "Arne Sommer", - "y" : 3, - "name" : "Arne Sommer" - }, - { - "y" : 4, - "drilldown" : "Athanasius", - "name" : "Athanasius" - }, - { - "name" : "Bob Lied", - "drilldown" : "Bob Lied", - "y" : 3 - }, - { - "y" : 2, - "drilldown" : "Clifton Wood", - "name" : "Clifton Wood" - }, - { - "name" : "Dave Jacoby", - "y" : 3, - "drilldown" : "Dave Jacoby" - }, - { - "drilldown" : "David Ferrone", - "y" : 2, - "name" : "David Ferrone" - }, - { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "y" : 3, - "drilldown" : "Ian Rifkin", - "name" : "Ian Rifkin" - }, - { - "drilldown" : "Jaldhar H. Vyas", - "y" : 5, - "name" : "Jaldhar H. Vyas" - }, - { - "name" : "Jorg Sommrey", - "drilldown" : "Jorg Sommrey", - "y" : 3 - }, - { - "drilldown" : "Kjetil Skotheim", - "y" : 2, - "name" : "Kjetil Skotheim" - }, - { - "drilldown" : "Laurent Rosenfeld", - "y" : 6, - "name" : "Laurent Rosenfeld" - }, - { - "name" : "librasteve", - "drilldown" : "librasteve", - "y" : 2 - }, - { - "name" : "Lubos Kolouch", - "y" : 4, - "drilldown" : "Lubos Kolouch" - }, - { - "drilldown" : "Luca Ferrari", - "y" : 10, - "name" : "Luca Ferrari" - }, - { - "y" : 2, - "drilldown" : "Mariano Spadaccini", - "name" : "Mariano Spadaccini" - }, - { - "name" : "Mark Anderson", - "drilldown" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Matthew Neleigh", - "y" : 2, - "name" : "Matthew Neleigh" - }, - { - "y" : 2, - "drilldown" : "Nelo Tovar", - "name" : "Nelo Tovar" - }, - { - "drilldown" : "Niels van Dijke", - "y" : 2, - "name" : "Niels van Dijke" - }, - { - "y" : 5, - "drilldown" : "Packy Anderson", - "name" : "Packy Anderson" - }, - { - "drilldown" : "Paulo Custodio", - "y" : 2, - "name" : "Paulo Custodio" - }, - { - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith", - "y" : 3 - }, - { - "name" : "Peter Meszaros", - "y" : 2, - "drilldown" : "Peter Meszaros" - }, - { - "y" : 3, - "drilldown" : "Robbie Hatley", - "name" : "Robbie Hatley" - }, - { - "name" : "Roger Bell_West", - "y" : 4, - "drilldown" : "Roger Bell_West" - }, - { - "y" : 4, - "drilldown" : "Thomas Kohler", - "name" : "Thomas Kohler" - }, - { - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke", - "y" : 4 - }, - { - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan", - "y" : 3 - } - ], - "colorByPoint" : 1, - "name" : "The Weekly Challenge - 243" - } - ], - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } - } + "legend" : { + "enabled" : 0 }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "tooltip" : { + "headerFormat" : "{series.name}
", + "followPointer" : 1, + "pointFormat" : "{point.name}: {point.y:f}
" }, "drilldown" : { "series" : [ { + "id" : "Ali Moradi", "name" : "Ali Moradi", "data" : [ [ @@ -200,10 +37,10 @@ "Blog", 1 ] - ], - "id" : "Ali Moradi" + ] }, { + "id" : "Arne Sommer", "name" : "Arne Sommer", "data" : [ [ @@ -214,11 +51,9 @@ "Blog", 1 ] - ], - "id" : "Arne Sommer" + ] }, { - "id" : "Athanasius", "data" : [ [ "Perl", @@ -229,9 +64,12 @@ 2 ] ], - "name" : "Athanasius" + "name" : "Athanasius", + "id" : "Athanasius" }, { + "id" : "Bob Lied", + "name" : "Bob Lied", "data" : [ [ "Perl", @@ -241,22 +79,41 @@ "Blog", 1 ] + ] + }, + { + "data" : [ + [ + "Raku", + 2 + ] ], - "name" : "Bob Lied", - "id" : "Bob Lied" + "name" : "Bruce Gray", + "id" : "Bruce Gray" }, { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Cheok-Yin Fung", + "id" : "Cheok-Yin Fung" + }, + { + "id" : "Clifton Wood", "name" : "Clifton Wood", "data" : [ [ "Raku", 2 ] - ], - "id" : "Clifton Wood" + ] }, { "id" : "Dave Jacoby", + "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -266,8 +123,7 @@ "Blog", 1 ] - ], - "name" : "Dave Jacoby" + ] }, { "id" : "David Ferrone", @@ -280,15 +136,25 @@ ] }, { + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "name" : "E. Choroba", "id" : "E. Choroba" }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Humberto Massa", + "id" : "Humberto Massa" + }, { "name" : "Ian Rifkin", "data" : [ @@ -322,7 +188,17 @@ "id" : "Jaldhar H. Vyas" }, { - "name" : "Jorg Sommrey", + "data" : [ + [ + "Raku", + 2 + ] + ], + "name" : "Jan Krnavek", + "id" : "Jan Krnavek" + }, + { + "id" : "Jorg Sommrey", "data" : [ [ "Perl", @@ -333,20 +209,20 @@ 1 ] ], - "id" : "Jorg Sommrey" + "name" : "Jorg Sommrey" }, { - "id" : "Kjetil Skotheim", - "name" : "Kjetil Skotheim", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Kjetil Skotheim", + "id" : "Kjetil Skotheim" }, { - "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -361,7 +237,7 @@ 2 ] ], - "name" : "Laurent Rosenfeld" + "id" : "Laurent Rosenfeld" }, { "name" : "librasteve", @@ -388,6 +264,7 @@ "id" : "Lubos Kolouch" }, { + "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -398,61 +275,59 @@ 8 ] ], - "name" : "Luca Ferrari", "id" : "Luca Ferrari" }, { + "id" : "Mariano Spadaccini", "name" : "Mariano Spadaccini", "data" : [ [ "Perl", 2 ] - ], - "id" : "Mariano Spadaccini" + ] }, { - "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson" + "id" : "Mark Anderson" }, { "id" : "Matthew Neleigh", - "name" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Matthew Neleigh" }, { "id" : "Nelo Tovar", - "name" : "Nelo Tovar", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Nelo Tovar" }, { "id" : "Niels van Dijke", + "name" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ], - "name" : "Niels van Dijke" + ] }, { - "id" : "Packy Anderson", "data" : [ [ "Perl", @@ -467,21 +342,21 @@ 1 ] ], - "name" : "Packy Anderson" + "name" : "Packy Anderson", + "id" : "Packy Anderson" }, { - "name" : "Paulo Custodio", "data" : [ [ "Perl", 2 ] ], + "name" : "Paulo Custodio", "id" : "Paulo Custodio" }, { "id" : "Peter Campbell Smith", - "name" : "Peter Campbell Smith", "data" : [ [ "Perl", @@ -491,7 +366,8 @@ "Blog", 1 ] - ] + ], + "name" : "Peter Campbell Smith" }, { "data" : [ @@ -504,6 +380,7 @@ "id" : "Peter Meszaros" }, { + "id" : "Robbie Hatley", "data" : [ [ "Perl", @@ -514,11 +391,9 @@ 1 ] ], - "name" : "Robbie Hatley", - "id" : "Robbie Hatley" + "name" : "Robbie Hatley" }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -529,7 +404,32 @@ 2 ] ], - "name" : "Roger Bell_West" + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" + }, + { + "id" : "Simon Green", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Simon Green" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Solathian", + "id" : "Solathian" }, { "id" : "Thomas Kohler", @@ -547,7 +447,6 @@ }, { "id" : "Ulrich Rieke", - "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -557,10 +456,20 @@ "Raku", 2 ] - ] + ], + "name" : "Ulrich Rieke" + }, + { + "id" : "Vinod Kumar K", + "data" : [ + [ + "Perl", + 1 + ] + ], + "name" : "Vinod Kumar K" }, { - "id" : "W. Luis Mochan", "name" : "W. Luis Mochan", "data" : [ [ @@ -571,16 +480,216 @@ "Blog", 1 ] - ] + ], + "id" : "W. Luis Mochan" } ] }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
", - "followPointer" : 1 + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } }, - "title" : { - "text" : "The Weekly Challenge - 243" + "series" : [ + { + "data" : [ + { + "drilldown" : "Ali Moradi", + "name" : "Ali Moradi", + "y" : 5 + }, + { + "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", + "y" : 3 + }, + { + "drilldown" : "Athanasius", + "name" : "Athanasius", + "y" : 4 + }, + { + "drilldown" : "Bob Lied", + "name" : "Bob Lied", + "y" : 3 + }, + { + "y" : 2, + "name" : "Bruce Gray", + "drilldown" : "Bruce Gray" + }, + { + "y" : 2, + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" + }, + { + "y" : 2, + "drilldown" : "Clifton Wood", + "name" : "Clifton Wood" + }, + { + "y" : 3, + "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby" + }, + { + "y" : 2, + "name" : "David Ferrone", + "drilldown" : "David Ferrone" + }, + { + "drilldown" : "E. Choroba", + "name" : "E. Choroba", + "y" : 2 + }, + { + "name" : "Humberto Massa", + "drilldown" : "Humberto Massa", + "y" : 2 + }, + { + "drilldown" : "Ian Rifkin", + "name" : "Ian Rifkin", + "y" : 3 + }, + { + "y" : 5, + "drilldown" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas" + }, + { + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek", + "y" : 2 + }, + { + "y" : 3, + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey" + }, + { + "y" : 2, + "name" : "Kjetil Skotheim", + "drilldown" : "Kjetil Skotheim" + }, + { + "y" : 6, + "name" : "Laurent Rosenfeld", + "drilldown" : "Laurent Rosenfeld" + }, + { + "drilldown" : "librasteve", + "name" : "librasteve", + "y" : 2 + }, + { + "y" : 4, + "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch" + }, + { + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari", + "y" : 10 + }, + { + "name" : "Mariano Spadaccini", + "drilldown" : "Mariano Spadaccini", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "y" : 2, + "drilldown" : "Matthew Neleigh", + "name" : "Matthew Neleigh" + }, + { + "name" : "Nelo Tovar", + "drilldown" : "Nelo Tovar", + "y" : 2 + }, + { + "y" : 2, + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke" + }, + { + "y" : 5, + "drilldown" : "Packy Anderson", + "name" : "Packy Anderson" + }, + { + "drilldown" : "Paulo Custodio", + "name" : "Paulo Custodio", + "y" : 2 + }, + { + "y" : 3, + "drilldown" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" + }, + { + "name" : "Peter Meszaros", + "drilldown" : "Peter Meszaros", + "y" : 2 + }, + { + "name" : "Robbie Hatley", + "drilldown" : "Robbie Hatley", + "y" : 3 + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 4 + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "drilldown" : "Solathian", + "name" : "Solathian", + "y" : 2 + }, + { + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler", + "y" : 4 + }, + { + "y" : 4, + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke" + }, + { + "drilldown" : "Vinod Kumar K", + "name" : "Vinod Kumar K", + "y" : 1 + }, + { + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan", + "y" : 3 + } + ], + "colorByPoint" : 1, + "name" : "The Weekly Challenge - 243" + } + ], + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index c9f1ff301f..756c806953 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -3,33 +3,39 @@ { "name" : "Contributions", "dataLabels" : { - "y" : 10, + "enabled" : "true", "color" : "#FFFFFF", - "rotation" : -90, - "align" : "right", "format" : "{point.y:.0f}", "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" }, - "enabled" : "true" + "y" : 10, + "rotation" : -90, + "align" : "right" }, "data" : [ [ "Blog", - 4201 + 4202 ], [ "Perl", - 12550 + 12557 ], [ "Raku", - 7237 + 7243 ] ] } ], + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, "xAxis" : { "type" : "category", "labels" : { @@ -39,25 +45,19 @@ } } }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2023]" + }, + "legend" : { + "enabled" : "false" }, "tooltip" : { "pointFormat" : "{point.y:.0f}" }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2023]" - }, "chart" : { "type" : "column" }, - "legend" : { - "enabled" : "false" - }, "subtitle" : { - "text" : "Last updated at 2023-11-18 22:52:19 GMT" + "text" : "Last updated at 2023-11-19 22:09:06 GMT" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 8c24fba68e..15c1892035 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,10 +1,6 @@ { - "xAxis" : { - "type" : "category" - }, "series" : [ { - "name" : "The Weekly Challenge Languages", "data" : [ { "y" : 164, @@ -12,44 +8,44 @@ "name" : "#001" }, { - "drilldown" : "002", "y" : 129, - "name" : "#002" + "name" : "#002", + "drilldown" : "002" }, { - "name" : "#003", "y" : 87, - "drilldown" : "003" + "drilldown" : "003", + "name" : "#003" }, { - "drilldown" : "004", "y" : 103, - "name" : "#004" + "name" : "#004", + "drilldown" : "004" }, { - "drilldown" : "005", "y" : 80, + "drilldown" : "005", "name" : "#005" }, { - "drilldown" : "006", "y" : 61, - "name" : "#006" + "name" : "#006", + "drilldown" : "006" }, { + "name" : "#007", "drilldown" : "007", - "y" : 69, - "name" : "#007" + "y" : 69 }, { - "drilldown" : "008", "y" : 82, - "name" : "#008" + "name" : "#008", + "drilldown" : "008" }, { + "name" : "#009", "drilldown" : "009", - "y" : 80, - "name" : "#009" + "y" : 80 }, { "name" : "#010", @@ -58,13 +54,13 @@ }, { "name" : "#011", - "y" : 89, - "drilldown" : "011" + "drilldown" : "011", + "y" : 89 }, { "y" : 92, - "drilldown" : "012", - "name" : "#012" + "name" : "#012", + "drilldown" : "012" }, { "y" : 87, @@ -77,9 +73,9 @@ "y" : 102 }, { - "name" : "#015", + "y" : 101, "drilldown" : "015", - "y" : 101 + "name" : "#015" }, { "y" : 75, @@ -87,58 +83,58 @@ "name" : "#016" }, { - "name" : "#017", "y" : 86, - "drilldown" : "017" + "drilldown" : "017", + "name" : "#017" }, { "y" : 83, - "drilldown" : "018", - "name" : "#018" + "name" : "#018", + "drilldown" : "018" }, { - "name" : "#019", "y" : 105, - "drilldown" : "019" + "drilldown" : "019", + "name" : "#019" }, { + "name" : "#020", "drilldown" : "020", - "y" : 103, - "name" : "#020" + "y" : 103 }, { + "name" : "#021", "drilldown" : "021", - "y" : 74, - "name" : "#021" + "y" : 74 }, { + "drilldown" : "022", "name" : "#022", - "y" : 72, - "drilldown" : "022" + "y" : 72 }, { "y" : 101, - "drilldown" : "023", - "name" : "#023" + "name" : "#023", + "drilldown" : "023" }, { - "y" : 77, "drilldown" : "024", - "name" : "#024" + "name" : "#024", + "y" : 77 }, { "name" : "#025", - "y" : 62, - "drilldown" : "025" + "drilldown" : "025", + "y" : 62 }, { - "y" : 76, + "name" : "#026", "drilldown" : "026", - "name" : "#026" + "y" : 76 }, { - "name" : "#027", "drilldown" : "027", + "name" : "#027", "y" : 64 }, { @@ -148,58 +144,58 @@ }, { "y" : 83, - "drilldown" : "029", - "name" : "#029" + "name" : "#029", + "drilldown" : "029" }, { - "y" : 121, + "name" : "#030", "drilldown" : "030", - "name" : "#030" + "y" : 121 }, { - "y" : 93, "drilldown" : "031", - "name" : "#031" + "name" : "#031", + "y" : 93 }, { "y" : 98, - "drilldown" : "032", - "name" : "#032" + "name" : "#032", + "drilldown" : "032" }, { "name" : "#033", - "y" : 114, - "drilldown" : "033" + "drilldown" : "033", + "y" : 114 }, { - "drilldown" : "034", "y" : 70, - "name" : "#034" + "name" : "#034", + "drilldown" : "034" }, { + "y" : 68, "name" : "#035", - "drilldown" : "035", - "y" : 68 + "drilldown" : "035" }, { - "name" : "#036", "y" : 70, - "drilldown" : "036" + "drilldown" : "036", + "name" : "#036" }, { - "name" : "#037", "y" : 70, - "drilldown" : "037" + "drilldown" : "037", + "name" : "#037" }, { - "drilldown" : "038", "y" : 74, - "name" : "#038" + "name" : "#038", + "drilldown" : "038" }, { - "drilldown" : "039", "y" : 68, - "name" : "#039" + "name" : "#039", + "drilldown" : "039" }, { "y" : 77, @@ -207,34 +203,34 @@ "name" : "#040" }, { - "drilldown" : "041", "y" : 80, - "name" : "#041" + "name" : "#041", + "drilldown" : "041" }, { "y" : 98, - "drilldown" : "042", - "name" : "#042" + "name" : "#042", + "drilldown" : "042" }, { "y" : 72, - "drilldown" : "043", - "name" : "#043" + "name" : "#043", + "drilldown" : "043" }, { - "name" : "#044", "y" : 90, - "drilldown" : "044" + "drilldown" : "044", + "name" : "#044" }, { "name" : "#045", - "y" : 102, - "drilldown" : "045" + "drilldown" : "045", + "y" : 102 }, { - "name" : "#046", "y" : 93, - "drilldown" : "046" + "drilldown" : "046", + "name" : "#046" }, { "name" : "#047", @@ -242,34 +238,34 @@ "y" : 88 }, { + "drilldown" : "048", "name" : "#048", - "y" : 112, - "drilldown" : "048" + "y" : 112 }, { - "name" : "#049", "drilldown" : "049", + "name" : "#049", "y" : 93 }, { - "y" : 104, + "name" : "#050", "drilldown" : "050", - "name" : "#050" + "y" : 104 }, { "name" : "#051", - "y" : 95, - "drilldown" : "051" + "drilldown" : "051", + "y" : 95 }, { - "name" : "#052", "y" : 93, + "name" : "#052", "drilldown" : "052" }, { "name" : "#053", - "y" : 105, - "drilldown" : "053" + "drilldown" : "053", + "y" : 105 }, { "y" : 107, @@ -277,9 +273,9 @@ "name" : "#054" }, { - "name" : "#055", "y" : 92, - "drilldown" : "055" + "drilldown" : "055", + "name" : "#055" }, { "y" : 104, @@ -287,64 +283,64 @@ "name" : "#056" }, { - "y" : 86, + "name" : "#057", "drilldown" : "057", - "name" : "#057" + "y" : 86 }, { - "name" : "#058", "drilldown" : "058", + "name" : "#058", "y" : 71 }, { "name" : "#059", - "y" : 93, - "drilldown" : "059" + "drilldown" : "059", + "y" : 93 }, { "y" : 89, - "drilldown" : "060", - "name" : "#060" + "name" : "#060", + "drilldown" : "060" }, { + "y" : 85, "name" : "#061", - "drilldown" : "061", - "y" : 85 + "drilldown" : "061" }, { "name" : "#062", - "y" : 62, - "drilldown" : "062" + "drilldown" : "062", + "y" : 62 }, { "name" : "#063", - "y" : 93, - "drilldown" : "063" + "drilldown" : "063