From fd7d80667121d4f63bef3c312246df63c4d5fd2b Mon Sep 17 00:00:00 2001 From: Simon Green Date: Sat, 14 Jan 2023 16:58:33 +1100 Subject: Simon's solution to challenge 199 --- challenge-199/sgreen/README.md | 4 ++-- challenge-199/sgreen/blog.txt | 1 + challenge-199/sgreen/perl/ch-1.pl | 28 ++++++++++++++++++++++++++++ challenge-199/sgreen/perl/ch-2.pl | 35 +++++++++++++++++++++++++++++++++++ challenge-199/sgreen/python/ch-1.py | 24 ++++++++++++++++++++++++ challenge-199/sgreen/python/ch-2.py | 30 ++++++++++++++++++++++++++++++ 6 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 challenge-199/sgreen/blog.txt create mode 100755 challenge-199/sgreen/perl/ch-1.pl create mode 100755 challenge-199/sgreen/perl/ch-2.pl create mode 100755 challenge-199/sgreen/python/ch-1.py create mode 100755 challenge-199/sgreen/python/ch-2.py diff --git a/challenge-199/sgreen/README.md b/challenge-199/sgreen/README.md index 5d5a8941b6..4708657f42 100644 --- a/challenge-199/sgreen/README.md +++ b/challenge-199/sgreen/README.md @@ -1,3 +1,3 @@ -# The Weekly Challenge 198 +# The Weekly Challenge 199 -[Blog](https://dev.to/simongreennet/weekly-challenge-198-2jbl) +Blog: [It's all good](https://dev.to/simongreennet/its-all-good-foe) diff --git a/challenge-199/sgreen/blog.txt b/challenge-199/sgreen/blog.txt new file mode 100644 index 0000000000..35487ed63c --- /dev/null +++ b/challenge-199/sgreen/blog.txt @@ -0,0 +1 @@ +https://dev.to/simongreennet/its-all-good-foe \ No newline at end of file diff --git a/challenge-199/sgreen/perl/ch-1.pl b/challenge-199/sgreen/perl/ch-1.pl new file mode 100755 index 0000000000..8e6481f644 --- /dev/null +++ b/challenge-199/sgreen/perl/ch-1.pl @@ -0,0 +1,28 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use experimental 'signatures'; + +sub main (@list) { + # Calculate the frequency of each integer + my %freq = (); + foreach my $i (@list) { + $freq{$i}++; + } + + my $solution = 0; + foreach my $f ( values(%freq) ) { + # If a value appears more than once, calculate the number of + # combinations. This is the sum of 1 + ... + f-1. + if ( $f > 1 ) { + $solution += $f * ( $f - 1 ) / 2; + } + } + + # Display the output + say $solution; +} + +main(@ARGV); \ No newline at end of file diff --git a/challenge-199/sgreen/perl/ch-2.pl b/challenge-199/sgreen/perl/ch-2.pl new file mode 100755 index 0000000000..f2d4f43c9e --- /dev/null +++ b/challenge-199/sgreen/perl/ch-2.pl @@ -0,0 +1,35 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use feature 'say'; +use experimental 'signatures'; + +use Algorithm::Combinatorics 'combinations'; + +sub main (@array) { + # Get the x, y, and z values from the input + my ( $x, $y, $z ) = splice( @array, -3 ); + + # The solution is the number of good triplets. + my $count = 0; + + # Work through all combinations of positions + my $iter = combinations( [ 0 .. $#array ], 3 ); + while ( my $x = $iter->next ) { + my ( $i, $j, $k ) = sort { $a <=> $b } @$x; + + # If we match the criteria, add one to the count + if ( abs( $array[$i] - $array[$j] ) <= $x + and abs( $array[$j] - $array[$k] ) <= $y + and abs( $array[$i] - $array[$k] ) <= $z ) + { + $count++; + } + } + + # Display the output + say $count; +} + +main(@ARGV); \ No newline at end of file diff --git a/challenge-199/sgreen/python/ch-1.py b/challenge-199/sgreen/python/ch-1.py new file mode 100755 index 0000000000..aebf116a45 --- /dev/null +++ b/challenge-199/sgreen/python/ch-1.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +import sys + + +def main(n): + # Calculate the frequency of each 'integer' + freq = {} + for i in n: + freq[i] = freq.get(i, 0)+1 + + solution = 0 + for f in freq.values(): + # If a value appears more than once, calculate the number of + # combinations. This is the sum of 1 + ... + f-1. + if f > 1: + solution += f * (f-1)//2 + + # Display the output + print(solution) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/challenge-199/sgreen/python/ch-2.py b/challenge-199/sgreen/python/ch-2.py new file mode 100755 index 0000000000..9536ef0e8b --- /dev/null +++ b/challenge-199/sgreen/python/ch-2.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +import sys +from itertools import combinations + + +def main(array): + # Get the x, y, and z values from the input + *array, x, y, z = array + + # The solution is the number of good triplets. + count = 0 + + # Work through all combinations of positions + for c in combinations(range(len(array)), 3): + i, j, k = sorted(c) + # If we match the criteria, add one to the count + if abs(array[i] - array[j]) <= x and \ + abs(array[j] - array[k]) <= y and \ + abs(array[i] - array[k]) <= z: + count += 1 + + # Display the output + print(count) + + +if __name__ == '__main__': + # Turn the strings into integers + n = [int(i) for i in sys.argv[1:]] + main(n) -- cgit From 7f12c8bb0d5f8dafd167dd73e4fb4c63e5981a01 Mon Sep 17 00:00:00 2001 From: PerlMonk-Athanasius Date: Sat, 14 Jan 2023 17:38:43 +1000 Subject: Perl & Raku solutions to Tasks 1 & 2 for Week 199 --- challenge-199/athanasius/perl/ch-1.pl | 199 ++++++++++++++++++++++++++++ challenge-199/athanasius/perl/ch-2.pl | 223 ++++++++++++++++++++++++++++++++ challenge-199/athanasius/raku/ch-1.raku | 201 ++++++++++++++++++++++++++++ challenge-199/athanasius/raku/ch-2.raku | 212 ++++++++++++++++++++++++++++++ 4 files changed, 835 insertions(+) create mode 100644 challenge-199/athanasius/perl/ch-1.pl create mode 100644 challenge-199/athanasius/perl/ch-2.pl create mode 100644 challenge-199/athanasius/raku/ch-1.raku create mode 100644 challenge-199/athanasius/raku/ch-2.raku diff --git a/challenge-199/athanasius/perl/ch-1.pl b/challenge-199/athanasius/perl/ch-1.pl new file mode 100644 index 0000000000..46ba4df6c2 --- /dev/null +++ b/challenge-199/athanasius/perl/ch-1.pl @@ -0,0 +1,199 @@ +#!perl + +############################################################################### +=comment + +Perl Weekly Challenge 199 +========================= + +TASK #1 +------- +*Good Pairs* + +Submitted by: Mohammad S Anwar + +You are given a list of integers, @list. + +Write a script to find the total count of Good Pairs. + + + A pair (i, j) is called good if list[i] == list[j] and i < j. + + +Example 1 + + Input: @list = (1,2,3,1,1,3) + Output: 4 + + There are 4 good pairs found as below: + (0,3) + (0,4) + (3,4) + (2,5) + +Example 2 + + Input: @list = (1,2,3) + Output: 0 + +Example 3 + + Input: @list = (1,1,1,1) + Output: 6 + + Good pairs are below: + (0,1) + (0,2) + (0,3) + (1,2) + (1,3) + (2,3) + +=cut +############################################################################### + +#--------------------------------------# +# Copyright © 2023 PerlMonk Athanasius # +#--------------------------------------# + +#============================================================================== +=comment + +Interface +--------- +1. If no command-line arguments are given, the test suite is run. +2. Otherwise, if $VERBOSE is set to a true value, an explanation like that in + Examples 1 and 3 is appended to the solution. + +=cut +#============================================================================== + +use strict; +use warnings; +use Const::Fast; +use Regexp::Common qw( number ); +use Test::More; + +const my $TEST_FIELDS => 3; +const my $VERBOSE => 1; +const my $USAGE => +"Usage: + perl $0 [ ...] + perl $0 + + [ ...] A list of 1 or more integers\n"; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + $| = 1; + print "\nChallenge 199, Task #1: Good Pairs (Perl)\n\n"; +} + +#============================================================================== +MAIN: +#============================================================================== +{ + if (scalar @ARGV == 0) + { + run_tests(); + } + else + { + my @list = @ARGV; + + for (@list) + { + / ^ $RE{num}{int} $ /x + or die qq[ERROR: "$_" is not a valid integer\n$USAGE]; + } + + printf "Input: \@list = (%s)\n", join ',', @list; + + my $pairs = find_good_pairs( \@list ); + + printf "Output: %d\n", scalar @$pairs; + + give_details( $pairs ) if $VERBOSE; + } +} + +#------------------------------------------------------------------------------ +sub find_good_pairs +#------------------------------------------------------------------------------ +{ + my ($list) = @_; + my @pairs; + + for my $i (0 .. $#$list - 1) + { + for my $j ($i + 1 .. $#$list) + { + if ($list->[ $i ] == $list->[ $j ]) + { + push @pairs, [ $i, $j ]; + } + } + } + + return \@pairs; +} + +#------------------------------------------------------------------------------ +sub give_details +#------------------------------------------------------------------------------ +{ + my ($pairs) = @_; + my $count = scalar @$pairs; + + if ($count == 0) + { + print "\nThere are no good pairs in the list\n"; + } + elsif ($count == 1) + { + printf "\nThere is 1 good pair in the list:\n(%s)\n", + join( ',', @{ $pairs->[ 0 ] }); + } + else + { + print "\nThere are $count good pairs in the list:\n"; + + print '(', join( ',', @$_ ), ")\n" for @$pairs; + } +} + +#------------------------------------------------------------------------------ +sub run_tests +#------------------------------------------------------------------------------ +{ + print "Running the test suite\n"; + + while (my $line = ) + { + chomp $line; + + my ($test_name, $input, $expected) = split /\|/, $line, $TEST_FIELDS; + + $input =~ s/ ^ \s* (.+?) \s* $ /$1/x; # Trim whitespace + $expected =~ s/ ^ \s* (.+?) \s* $ /$1/x; + $expected =~ s/ \s+ / /gx; + + my @list = split / , \s* /x, $input; + my $pairs = find_good_pairs( \@list ); + my $got = scalar @$pairs; + + is $got, $expected, $test_name; + } + + done_testing; +} + +############################################################################### + +__DATA__ +Example 1| 1, 2, 3, 1, 1, 3|4 +Example 2| 1, 2, 3 |0 +Example 3| 1, 1, 1, 1 |6 +Negatives|-1,-2,-3,-1,-1,-3|4 diff --git a/challenge-199/athanasius/perl/ch-2.pl b/challenge-199/athanasius/perl/ch-2.pl new file mode 100644 index 0000000000..0e657665d2 --- /dev/null +++ b/challenge-199/athanasius/perl/ch-2.pl @@ -0,0 +1,223 @@ +#!perl + +############################################################################### +=comment + +Perl Weekly Challenge 199 +========================= + +TASK #2 +------- +*Good Triplets* + +Submitted by: Mohammad S Anwar + +You are given an array of integers, @array and three integers $x,$y,$z. + +Write a script to find out total Good Triplets in the given array. + +A triplet array[i], array[j], array[k] is good if it satisfies the following +conditions: + + a) 0 <= i < j < k <= n (size of given array) + b) abs(array[i] - array[j]) <= x + c) abs(array[j] - array[k]) <= y + d) abs(array[i] - array[k]) <= z + +Example 1 + + Input: @array = (3,0,1,1,9,7) and $x = 7, $y = 2, $z = 3 + Output: 4 + + Good Triplets are as below: + (3,0,1) where (i=0, j=1, k=2) + (3,0,1) where (i=0, j=1, k=3) + (3,1,1) where (i=0, j=2, k=3) + (0,1,1) where (i=1, j=2, k=3) + +Example 2 + + Input: @array = (1,1,2,2,3) and $x = 0, $y = 0, $z = 1 + Output: 0 + +=cut +############################################################################### + +#--------------------------------------# +# Copyright © 2023 PerlMonk Athanasius # +#--------------------------------------# + +#============================================================================== +=comment + +Interface +--------- +1. If no command-line argument is given, the test suite is run. Otherwise: +2. N.B.: $x, $y, $z must appear on the command line (in that order) BEFORE the + elements of @array. +3. If $VERBOSE is set to a true value, an explanation like that in Example 1 is + appended to the solution. + +=cut +#============================================================================== + +use strict; +use warnings; +use Const::Fast; +use Regexp::Common qw( number ); +use Test::More; + +const my $TEST_FIELDS => 3; +const my $VERBOSE => 1; +const my $USAGE => +"Usage: + perl $0 [ ...] + perl $0 + + An integer + An integer + An integer + [ ...] A list of integers\n"; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + $| = 1; + print "\nChallenge 199, Task #2: Good Triplets (Perl)\n\n"; +} + +#============================================================================== +MAIN: +#============================================================================== +{ + my $args = scalar @ARGV; + + if ($args == 0) + { + run_tests(); + } + elsif ($args < 3) + { + error( "Expected 0 or 3+ arguments, found $args" ); + } + else + { + for (@ARGV) + { + / ^ $RE{num}{int} $ /x or error( qq["$_" is not a valid integer] ); + } + + my ($x, $y, $z, @array) = @ARGV; + + printf "Input: \@array = (%s) and \$x = %d, \$y = %d, \$z = %d\n", + join( ',', @array ), $x, $y, $z; + + my $triplets = find_good_triplets( $x, $y, $z, \@array ); + + printf "Output: %d\n", scalar @$triplets; + + give_details( \@array, $triplets ) if $VERBOSE; + } +} + +#------------------------------------------------------------------------------ +sub find_good_triplets +#------------------------------------------------------------------------------ +{ + my ($x, $y, $z, $array) = @_; + my @triplets; + + for my $i (0 .. $#$array - 2) + { + for my $j ($i + 1 .. $#$array - 1) + { + if (abs( $array->[ $i ] - $array->[ $j ] ) <= $x) + { + for my $k ($j + 1 .. $#$array) + { + if (abs( $array->[ $j ] - $array->[ $k ] ) <= $y && + abs( $array->[ $i ] - $array->[ $k ] ) <= $z) + { + push @triplets, [ $i, $j, $k ]; + } + } + } + } + } + + return \@triplets; +} + +#------------------------------------------------------------------------------ +sub give_details +#------------------------------------------------------------------------------ +{ + my ($array, $triplets) = @_; + my $count = scalar @$triplets; + + if ($count == 0) + { + print "\nThere are no good triplets in the array\n"; + } + elsif ($count == 1) + { + print "\nThere is 1 good triplet in the array:\n"; + + my @indices = @{ $triplets->[ 0 ] }; + + printf "(%s) where (i=%d, j=%d, k=%d)\n", + join( ',', (@$array)[ @indices ] ), @indices; + } + else + { + print "\nThere are $count good triplets in the array:\n"; + + for (@$triplets) + { + printf "(%s) where (i=%d, j=%d, k=%d)\n", + join( ',', (@$array)[ @$_ ] ), @$_; + } + } +} + +#------------------------------------------------------------------------------ +sub error +#------------------------------------------------------------------------------ +{ + my ($message) = @_; + + die "ERROR: $message\n$USAGE"; +} + +#------------------------------------------------------------------------------ +sub run_tests +#------------------------------------------------------------------------------ +{ + print "Running the test suite\n"; + + while (my $line = ) + { + chomp $line; + + my ($test_name, $in, $expected) = split / \| /x, $line, $TEST_FIELDS; + + s/ ^ \s* (.+?) \s* $ /$1/x # Trim whitespace + for $test_name, $in, $expected; + + my ($x, $y, $z, @array) = split / , /x, $in; + + my $triplets = find_good_triplets( $x, $y, $z, \@array ); + + is scalar @$triplets, $expected, $test_name; + } + + done_testing; +} + +############################################################################### + +__DATA__ +Example 1|7,2,3,3,0,1,1,9,7|4 +Example 2|0,0,1,1,1,2,2,3 |0 +Single |7,2,3,3,0,1 |1 diff --git a/challenge-199/athanasius/raku/ch-1.raku b/challenge-199/athanasius/raku/ch-1.raku new file mode 100644 index 0000000000..6d93d77e13 --- /dev/null +++ b/challenge-199/athanasius/raku/ch-1.raku @@ -0,0 +1,201 @@ +use v6d; + +############################################################################### +=begin comment + +Perl Weekly Challenge 199 +========================= + +TASK #1 +------- +*Good Pairs* + +Submitted by: Mohammad S Anwar + +You are given a list of integers, @list. + +Write a script to find the total count of Good Pairs. + + + A pair (i, j) is called good if list[i] == list[j] and i < j. + + +Example 1 + + Input: @list = (1,2,3,1,1,3) + Output: 4 + + There are 4 good pairs found as below: + (0,3) + (0,4) + (3,4) + (2,5) + +Example 2 + + Input: @list = (1,2,3) + Output: 0 + +Example 3 + + Input: @list = (1,1,1,1) + Output: 6 + + Good pairs are below: + (0,1) + (0,2) + (0,3) + (1,2) + (1,3) + (2,3) + +=end comment +############################################################################### + +#--------------------------------------# +# Copyright © 2023 PerlMonk Athanasius # +#--------------------------------------# + +#============================================================================== +=begin comment + +Interface +--------- +1. If no command-line arguments are given, the test suite is run. Otherwise: +2. If the first argument is negative, it must be preceded by "--" to distin- + guish it from a command-line flag. +3. If $VERBOSE is set to True, an explanation like that in Examples 1 and 3 is + appended to the solution. + +=end comment +#============================================================================== + +use Test; + +my UInt constant $TEST-FIELDS = 3; +my Bool constant $VERBOSE = True; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + "\nChallenge 199, Task #1: Good Pairs (Raku)\n".put; +} + +#============================================================================== +multi sub MAIN +( + #| A list of 1 or more integers + + *@list where { .elems >= 1 && .all ~~ Int:D } +) +#============================================================================== +{ + "Input: \@list = (%s)\n".printf: @list.join: ','; + + my Array[UInt] @pairs = find-good-pairs( @list ); + + "Output: %d\n".printf: @pairs.elems; + + give-details( @pairs ) if $VERBOSE; +} + +#============================================================================== +multi sub MAIN() # No input: run the test suite +#============================================================================== +{ + run-tests(); +} + +#------------------------------------------------------------------------------ +sub find-good-pairs( List:D[Int:D] $list --> List:D[List:D[UInt:D]]) +#------------------------------------------------------------------------------ +{ + my Array[UInt] @pairs; + + for 0 .. $list.end - 1 -> UInt $i + { + for $i + 1 .. $list.end -> UInt $j + { + if $list[ $i ] == $list[ $j ] + { + @pairs.push: Array[UInt].new: $i, $j; + } + } + } + + return @pairs; +} + +#------------------------------------------------------------------------------ +sub give-details( List:D[UInt:D] $pairs ) +#------------------------------------------------------------------------------ +{ + my UInt $count = $pairs.elems; + + if $count == 0 + { + "\nThere are no good pairs in the list".put; + } + elsif $count == 1 + { + "\nThere is 1 good pair in the list:\n(%s)\n".printf: + @$pairs[ 0 ].join: ','; + } + else + { + "\nThere are $count good pairs in the list:".put; + + ('(' ~ @$_.join( ',' ) ~ ')').put for @$pairs; + } +} + +#------------------------------------------------------------------------------ +sub run-tests() +#------------------------------------------------------------------------------ +{ + 'Running the test suite'.put; + + for test-data.lines -> Str $line + { + my Str ($test-name, $input, $expected) = + $line.split: / \| /, $TEST-FIELDS; + + $input ~~ s/ ^ \s* (.+?) \s* $ /$0/; # Trim whitespace + $expected ~~ s/ ^ \s* (.+?) \s* $ /$0/; + $expected ~~ s:g/ \s+ / /; + + my Int @list = $input.split( / \, \s* / ).map: { .Int }; + my Array[UInt] @pairs = find-good-pairs( @list ); + my UInt $got = @pairs.elems; + + is $got, $expected, $test-name; + } + + done-testing; +} + +#------------------------------------------------------------------------------ +sub USAGE() +#------------------------------------------------------------------------------ +{ + my Str $usage = $*USAGE; + + $usage ~~ s:g/ ($*PROGRAM-NAME) /raku $0/; + + $usage.put; +} + +#------------------------------------------------------------------------------ +sub test-data( --> Str:D ) +#------------------------------------------------------------------------------ +{ + return q:to/END/; + Example 1| 1, 2, 3, 1, 1, 3|4 + Example 2| 1, 2, 3 |0 + Example 3| 1, 1, 1, 1 |6 + Negatives|-1,-2,-3,-1,-1,-3|4 + END +} + +############################################################################### diff --git a/challenge-199/athanasius/raku/ch-2.raku b/challenge-199/athanasius/raku/ch-2.raku new file mode 100644 index 0000000000..a13936da5d --- /dev/null +++ b/challenge-199/athanasius/raku/ch-2.raku @@ -0,0 +1,212 @@ +use v6d; + +############################################################################### +=begin comment + +Perl Weekly Challenge 199 +========================= + +TASK #2 +------- +*Good Triplets* + +Submitted by: Mohammad S Anwar + +You are given an array of integers, @array and three integers $x,$y,$z. + +Write a script to find out total Good Triplets in the given array. + +A triplet array[i], array[j], array[k] is good if it satisfies the following +conditions: + + a) 0 <= i < j < k <= n (size of given array) + b) abs(array[i] - array[j]) <= x + c) abs(array[j] - array[k]) <= y + d) abs(array[i] - array[k]) <= z + +Example 1 + + Input: @array = (3,0,1,1,9,7) and $x = 7, $y = 2, $z = 3 + Output: 4 + + Good Triplets are as below: + (3,0,1) where (i=0, j=1, k=2) + (3,0,1) where (i=0, j=1, k=3) + (3,1,1) where (i=0, j=2, k=3) + (0,1,1) where (i=1, j=2, k=3) + +Example 2 + + Input: @array = (1,1,2,2,3) and $x = 0, $y = 0, $z = 1 + Output: 0 + +=end comment +############################################################################### + +#--------------------------------------# +# Copyright © 2023 PerlMonk Athanasius # +#--------------------------------------# + +#============================================================================== +=begin comment + +Interface +--------- +1. If no command-line arguments are given, the test suite is run. Otherwise: +2. N.B.: $x, $y, $z must appear on the command line (in that order) BEFORE the + elements of @array. +3. If the first argument is negative, it must be preceded by "--" to distin- + guish it from a command-line flag. +4. If $VERBOSE is set to a true value, an explanation like that in Example 1 is + appended to the solution. + +=end comment +#============================================================================== + +use Test; + +my UInt constant $TEST-FIELDS = 3; +my Bool constant $VERBOSE = True; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + "\nChallenge 199, Task #2: Good Triplets (Raku)\n".put; +} + +#============================================================================== +multi sub MAIN +( + Int:D $x, #= An integer + Int:D $y, #= An integer + Int:D $z, #= An integer + *@array where { .all ~~ Int:D } #= A list of integers +) +#============================================================================== +{ + "Input: \@array = (%s) and \$x = %d, \$y = %d, \$z = %d\n".printf: + @array.join( ',' ), $x, $y, $z; + + my Array[UInt] @triplets = find-good-triplets( $x, $y, $z, @array ); + + "Output: %d\n".printf: @triplets.elems; + + give-details( @array, @triplets ) if $VERBOSE; +} + +#============================================================================== +multi sub MAIN() # Run the test suite +#============================================================================== +{ + run-tests(); +} + +#------------------------------------------------------------------------------ +sub find-good-triplets +( + Int:D $x, + Int:D $y, + Int:D $z, + List:D[Int:D] $array +--> List:D[List:D[UInt:D]] +) +#------------------------------------------------------------------------------ +{ + my Array[UInt] @triplets; + + for 0 .. $array.end - 2 -> UInt $i + { + for $i + 1 .. $array.end - 1 -> UInt $j + { + if ($array[ $i ] - $array[ $j ]).abs <= $x + { + for $j + 1 .. $array.end -> UInt $k + { + if ($array[ $j ] - $array[ $k ]).abs <= $y && + ($array[ $i ] - $array[ $k ]).abs <= $z + { + @triplets.push: Array[UInt].new: $i, $j, $k; + } + } + } + } + } + + return @triplets; +} + +#------------------------------------------------------------------------------ +sub give-details( List:D[Int:D] $array, List:D[List:D[UInt:D]] $triplets ) +#------------------------------------------------------------------------------ +{ + my UInt $count = $triplets.elems; + + if $count == 0 + { + "\nThere are no good triplets in the array".put; + } + elsif $count == 1 + { + "\nThere is 1 good triplet in the array:\n".put; + + "(%s) where (i=%d, j=%d, k=%d)\n".printf: + $array[ |$triplets[ 0 ] ].join( ',' ), |$triplets[ 0 ]; + } + else + { + "\nThere are $count good triplets in the array:".put; + + "(%s) where (i=%d, j=%d, k=%d)\n".printf: + $array[ @$_ ].join( ',' ), @$_ for @$triplets; + } +} + +#------------------------------------------------------------------------------ +sub run-tests() +#------------------------------------------------------------------------------ +{ + 'Running the test suite'.put; + + for test-data.lines -> Str $line + { + my Str ($test-name, $input, $expected) = + $line.split: / \| /, $TEST-FIELDS; + + s/ ^ \s* (.+?) \s* $ /$0/ # Trim whitespace + for $test-name, $input, $expected; + + my Int ($x, $y, $z, @array) = + $input.split( / \, /, :skip-empty ).map: { .Int }; + + my UInt $got = find-good-triplets( $x, $y, $z, @array ).elems; + + is $got, $expected.Int, $test-name; + } + + done-testing; +} + +#------------------------------------------------------------------------------ +sub USAGE() +#------------------------------------------------------------------------------ +{ + my Str $usage = $*USAGE; + + $usage ~~ s:g/ ($*PROGRAM-NAME) /raku $0/; + + $usage.put; +} + +#------------------------------------------------------------------------------ +sub test-data( --> Str:D ) +#------------------------------------------------------------------------------ +{ + return q:to/END/; + Example 1|7,2,3,3,0,1,1,9,7|4 + Example 2|0,0,1,1,1,2,2,3 |0 + Single |7,2,3,3,0,1 |1 + END +} + +############################################################################### -- cgit From f782a2eb7d03154cc8242030b78f02332c980f1a Mon Sep 17 00:00:00 2001 From: Solathian Date: Sat, 14 Jan 2023 17:15:03 +0100 Subject: adding files for challenge 199 --- challenge-199/solathian/perl/ch-1.pl | 27 ++++++++++++++++++++++++++ challenge-199/solathian/perl/ch-2.pl | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 challenge-199/solathian/perl/ch-1.pl create mode 100644 challenge-199/solathian/perl/ch-2.pl diff --git a/challenge-199/solathian/perl/ch-1.pl b/challenge-199/solathian/perl/ch-1.pl new file mode 100644 index 0000000000..fa730a6ebe --- /dev/null +++ b/challenge-199/solathian/perl/ch-1.pl @@ -0,0 +1,27 @@ +#!usr/bin/perl +use v5.36; + +# Challange 198 - 1 - Good Pairs +# You are given a list of integers, @list. +# Write a script to find the total count of Good Pairs. +# A pair (i, j) is called good if list[i] == list[j] and i < j. + +gp(1,2,3,1,1,3); # 4 +gp(1,2,3); # 0 +gp(1,1,1,1); # 6 + +sub gp(@array) +{ + my $count = 0; + + for(my $i = 0; $i < $#array; $i++) + { + for(my $j = $i+1; $j < @array; $j++) + { + $count++ if($array[$i] == $array[$j]); + } + } + + say $count; + return $count +} \ No newline at end of file diff --git a/challenge-199/solathian/perl/ch-2.pl b/challenge-199/solathian/perl/ch-2.pl new file mode 100644 index 0000000000..3d377c551b --- /dev/null +++ b/challenge-199/solathian/perl/ch-2.pl @@ -0,0 +1,37 @@ +#!usr/bin/perl + +use v5.36; +use builtin 'indexed'; +no warnings builtin::indexed; + +# Challange 199 - 2 - Good Triplets +# You are given an array of integers, @array and three integers $x,$y,$z. +# Write a script to find out total Good Triplets in the given array. +# A triplet array[i], array[j], array[k] is good if it satisfies the following conditions: + +goodTriplets([3,0,1,1,9,7], 7, 2, 3); # 4 +goodTriplets([1,1,2,2,3], 0, 0, 1); # 0 + +sub goodTriplets($array, $x, $y, $z ) +{ + my $count = 0; + + foreach my ($i, $iVal) (indexed @$array) + { + foreach my ($j, $jVal) (indexed @$array) + { + foreach my ($k, $kVal) (indexed @$array) + { + next if( not ( $i < $j < $k)); # a) 0 <= i < j < k <= n (size of given array) + next if( not (abs( $iVal - $jVal) <= $x)); # b) abs(array[i] - array[j]) <= x + next if( not (abs( $jVal - $kVal) <= $y)); # c) abs(array[j] - array[k]) <= y + next if( not (abs( $iVal - $kVal) <= $y)); # d) abs(array[i] - array[k]) <= z + + $count++; + } + } + } + + say $count; + return $count +} \ No newline at end of file -- cgit From b2f57d8f8f8ac453f3b6ec39acbff67e6deea654 Mon Sep 17 00:00:00 2001 From: arnesom Date: Sat, 14 Jan 2023 21:02:47 +0100 Subject: Arne Sommer --- challenge-199/arne-sommer/blog.txt | 1 + challenge-199/arne-sommer/raku/ch-1.raku | 5 +++++ challenge-199/arne-sommer/raku/ch-2.raku | 24 ++++++++++++++++++++++++ challenge-199/arne-sommer/raku/good-pairs | 16 ++++++++++++++++ challenge-199/arne-sommer/raku/good-pairs-map | 5 +++++ challenge-199/arne-sommer/raku/good-triplets | 24 ++++++++++++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 challenge-199/arne-sommer/blog.txt create mode 100755 challenge-199/arne-sommer/raku/ch-1.raku create mode 100755 challenge-199/arne-sommer/raku/ch-2.raku create mode 100755 challenge-199/arne-sommer/raku/good-pairs create mode 100755 challenge-199/arne-sommer/raku/good-pairs-map create mode 100755 challenge-199/arne-sommer/raku/good-triplets diff --git a/challenge-199/arne-sommer/blog.txt b/challenge-199/arne-sommer/blog.txt new file mode 100644 index 0000000000..dbab4154cb --- /dev/null +++ b/challenge-199/arne-sommer/blog.txt @@ -0,0 +1 @@ +https://raku-musings.com/twice-as-good.html diff --git a/challenge-199/arne-sommer/raku/ch-1.raku b/challenge-199/arne-sommer/raku/ch-1.raku new file mode 100755 index 0000000000..4f1e7cf383 --- /dev/null +++ b/challenge-199/arne-sommer/raku/ch-1.raku @@ -0,0 +1,5 @@ +#! /usr/bin/env raku + +unit sub MAIN (*@list where @list.elems > 0 && all(@list) ~~ /^<[0..9]>*$/); + +say @list.Bag.values.map({ (" " xx $_).combinations(2).elems }).sum; diff --git a/challenge-199/arne-sommer/raku/ch-2.raku b/challenge-199/arne-sommer/raku/ch-2.raku new file mode 100755 index 0000000000..5eb5e7da9c --- /dev/null +++ b/challenge-199/arne-sommer/raku/ch-2.raku @@ -0,0 +1,24 @@ +#! /usr/bin/env raku + +unit sub MAIN (Int $x, Int $y, Int $z, *@array where @array.elems > 0 && all(@array) ~~ /^<[0..9]>*$/, :v(:$verbose)); + +my $triplets = 0; + +for 0 .. @array.end - 2 -> $i +{ + for $i + 1 .. @array.end - 1 -> $j + { + for $j + 1 .. @array.end -> $k + { + next unless abs(@array[$i] - @array[$j]) <= $x; + next unless abs(@array[$j] - @array[$k]) <= $y; + next unless abs(@array[$i] - @array[$k]) <= $z; + + $triplets++; + + say ": (@array[$i, $j, $k]) where (i=$i, j=$j, k=$k)" if $verbose; + } + } +} + +say $triplets; diff --git a/challenge-199/arne-sommer/raku/good-pairs b/challenge-199/arne-sommer/raku/good-pairs new file mode 100755 index 0000000000..9029ac2a89 --- /dev/null +++ b/challenge-199/arne-sommer/raku/good-pairs @@ -0,0 +1,16 @@ +#! /usr/bin/env raku + +unit sub MAIN (*@list where @list.elems > 0 && all(@list) ~~ /^<[0..9]>*$/, :v(:$verbose)); + +my $bag = @list>>.Int.Bag; + +say ": { $bag.raku }" if $verbose; + +my $total = 0; + +for $bag.values -> $count +{ + $total += (" " xx $count).combinations(2).elems; +} + +say $total; diff --git a/challenge-199/arne-sommer/raku/good-pairs-map b/challenge-199/arne-sommer/raku/good-pairs-map new file mode 100755 index 0000000000..4f1e7cf383 --- /dev/null +++ b/challenge-199/arne-sommer/raku/good-pairs-map @@ -0,0 +1,5 @@ +#! /usr/bin/env raku + +unit sub MAIN (*@list where @list.elems > 0 && all(@list) ~~ /^<[0..9]>*$/); + +say @list.Bag.values.map({ (" " xx $_).combinations(2).elems }).sum; diff --git a/challenge-199/arne-sommer/raku/good-triplets b/challenge-199/arne-sommer/raku/good-triplets new file mode 100755 index 0000000000..5eb5e7da9c --- /dev/null +++ b/challenge-199/arne-sommer/raku/good-triplets @@ -0,0 +1,24 @@ +#! /usr/bin/env raku + +unit sub MAIN (Int $x, Int $y, Int $z, *@array where @array.elems > 0 && all(@array) ~~ /^<[0..9]>*$/, :v(:$verbose)); + +my $triplets = 0; + +for 0 .. @array.end - 2 -> $i +{ + for $i + 1 .. @array.end - 1 -> $j + { + for $j + 1 .. @array.end -> $k + { + next unless abs(@array[$i] - @array[$j]) <= $x; + next unless abs(@array[$j] - @array[$k]) <= $y; + next unless abs(@array[$i] - @array[$k]) <= $z; + + $triplets++; + + say ": (@array[$i, $j, $k]) where (i=$i, j=$j, k=$k)" if $verbose; + } + } +} + +say $triplets; -- cgit From b3b746a6b9797b88260332df5dfafb952bab2faf Mon Sep 17 00:00:00 2001 From: carlos157oliveira Date: Sat, 14 Jan 2023 18:19:51 -0300 Subject: solution to challenge 199 --- challenge-199/carlos-oliveira/raku/ch-1.raku | 18 ++++++++++++++++++ challenge-199/carlos-oliveira/raku/ch-2.raku | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 challenge-199/carlos-oliveira/raku/ch-1.raku create mode 100644 challenge-199/carlos-oliveira/raku/ch-2.raku diff --git a/challenge-199/carlos-oliveira/raku/ch-1.raku b/challenge-199/carlos-oliveira/raku/ch-1.raku new file mode 100644 index 0000000000..1146a7aa1f --- /dev/null +++ b/challenge-199/carlos-oliveira/raku/ch-1.raku @@ -0,0 +1,18 @@ +use Test; + + +sub good-pairs (Int:D @integers --> List:D[Int:D]) { + my $list-end = @integers.end; + my @pairs; + for (0..$list-end X 0..$list-end).grep: { @_[0] < @_[1] } -> ($i, $j) { + if @integers[$i] == @integers[$j] { + @pairs.push: ($i, $j) + } + } + return @pairs; +} + + +is good-pairs(my Int @ = 1,2,3,1,1,3), [(0, 3), (0, 4), (2, 5), (3, 4)], 'Test 1'; +is good-pairs(my Int @ = 1,2,3), [], 'Test 2'; +is good-pairs(my Int @ = 1,1,1,1), [(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)], 'Test 3'; diff --git a/challenge-199/carlos-oliveira/raku/ch-2.raku b/challenge-199/carlos-oliveira/raku/ch-2.raku new file mode 100644 index 0000000000..97a4d664a0 --- /dev/null +++ b/challenge-199/carlos-oliveira/raku/ch-2.raku @@ -0,0 +1,23 @@ +use Test; + + +sub good-triplets (Int:D @integers, Int:D :$x!, Int:D :$y!, Int:D :$z! --> List:D[Int:D]) { + my $end = @integers.end; + my @triplets; + for (0..$end X 0..$end X 0..$end).grep: { @_[0] < @_[1] < @_[2] } -> ($i, $j, $k) { + ($x, $y, $z) + ==> zip ( + abs(@integers[$i] - @integers[$j]), + abs(@integers[$j] - @integers[$k]), + abs(@integers[$i] - @integers[$k]) + ) + ==> map({ @_[0] <= @_[1] }) + ==> my @result; + @triplets.push: (@integers[$i], @integers[$j], @integers[$k]) if all(@result); + } + return @triplets; +} + + +is good-triplets(Array[Int].new(3,0,1,1,9,7), :x(7), :y(2), :z(3)), [<3 0 1>, <3 0 1>, <3 1 1>, <0 1 1>]; +is good-triplets(Array[Int].new(1,1,2,2,3), :x(0), :y(0), :z(1)), []; -- cgit From 4a4950187cdaa022b2f111637b7562b3948fac21 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sat, 14 Jan 2023 22:58:41 +0000 Subject: - Added solutions by Simon Green. - Added solutions by Athanasius. - Added solutions by Bob Lied. - Added solutions by Solathian. - Added solutions by Arne Sommer. - Added solutions by Carlos Oliveira. --- challenge-199/robert-dicicco/julia/ch-2.jl | 85 ++ challenge-199/robert-dicicco/python/ch-2.py | 75 ++ challenge-199/robert-dicicco/ruby/ch-2.rb | 81 ++ stats/pwc-challenge-187.json | 295 +++--- stats/pwc-challenge-188.json | 289 +++--- stats/pwc-current.json | 447 +++++---- stats/pwc-language-breakdown-summary.json | 70 +- stats/pwc-language-breakdown.json | 1370 +++++++++++++-------------- stats/pwc-leaders.json | 758 +++++++-------- stats/pwc-summary-1-30.json | 124 +-- stats/pwc-summary-121-150.json | 40 +- stats/pwc-summary-151-180.json | 118 +-- stats/pwc-summary-181-210.json | 38 +- stats/pwc-summary-211-240.json | 50 +- stats/pwc-summary-241-270.json | 100 +- stats/pwc-summary-271-300.json | 40 +- stats/pwc-summary-31-60.json | 36 +- stats/pwc-summary-61-90.json | 94 +- stats/pwc-summary-91-120.json | 40 +- stats/pwc-summary.json | 58 +- 20 files changed, 2283 insertions(+), 1925 deletions(-) create mode 100644 challenge-199/robert-dicicco/julia/ch-2.jl create mode 100644 challenge-199/robert-dicicco/python/ch-2.py create mode 100644 challenge-199/robert-dicicco/ruby/ch-2.rb diff --git a/challenge-199/robert-dicicco/julia/ch-2.jl b/challenge-199/robert-dicicco/julia/ch-2.jl new file mode 100644 index 0000000000..9818322da7 --- /dev/null +++ b/challenge-199/robert-dicicco/julia/ch-2.jl @@ -0,0 +1,85 @@ +#!/usr/bin/env julia + +#= + +AUTHOR: Robert DiCicco + +DATE : 2023-01-13 + +Challenge 199 Good Triplets ( Julia ) + +=# + +using Combinatorics + +  + +list = [3,0,1,1,9,7] + +x = 7 + +y = 2 + +z = 3 + +  + +seen = Dict() + +  + +for zz in combinations(list,3) + + if ! haskey(seen,zz) + + seen[zz] = 1 + + end + +end + +  + +for ( key,_ ) in seen + + x1 = findfirst(item -> item == key[1], list) + + x2 = findfirst(item -> item == key[2], list) + + x3 = findfirst(item -> item == key[3], list) + + if x1 > x2 || x2 > x3 || x1 > x3 + + continue + + else + + if abs(key[1] - key[2]) > x || abs(key[2] - key[3]) > y || abs(key[1] - key[3]) > z + + #println(key) + + else + + println(key) + + end + + end + +end + +  + +#= + +SAMPLE OUTPUT + +julia .\GoodTriplets.jl + +[3, 0, 1] + +[3, 1, 1] + +[0, 1, 1] + +=# diff --git a/challenge-199/robert-dicicco/python/ch-2.py b/challenge-199/robert-dicicco/python/ch-2.py new file mode 100644 index 0000000000..eacb4768ae --- /dev/null +++ b/challenge-199/robert-dicicco/python/ch-2.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python + +''' + +AUTHOR: Robert DiCicco + +DATE : 2023-01-14 + +Challenge 199 Good Triplets ( Python ) + +''' + +from itertools import combinations + +  + +list1 = [3,0,1,1,9,7] + +x = 7 + +y = 2 + +z = 3 + +  + +seen = {} + +  + +for res in (list(combinations(list1, 3))): + + if res in seen: + + continue + + else: + + x1 = list1.index(res[0]) + + x2 = list1.index(res[1]) + + x3 = list1.index(res[2]) + + if x1 > x2 or x2 > x3 or x1 > x3: + + continue + + else: + + if abs(res[0] - res[1]) > x or abs(res[1] - res[2]) > y or abs(res[0] - res[2]) > z : + + continue + + else: + + print(res) + + seen[res] = 1 + +        + +''' + +SAMPLE OUTPUT + +python .\GoodTriplets.py + +(3, 0, 1) + +(3, 1, 1) + +(0, 1, 1) + +''' diff --git a/challenge-199/robert-dicicco/ruby/ch-2.rb b/challenge-199/robert-dicicco/ruby/ch-2.rb new file mode 100644 index 0000000000..624000a2b4 --- /dev/null +++ b/challenge-199/robert-dicicco/ruby/ch-2.rb @@ -0,0 +1,81 @@ +#!/usr/bin/env ruby + +=begin + +AUTHOR: Robert DiCicco + +DATE : 2023-01-14 + +Challenge 199 Good Triplets ( Ruby ) + +=end + +  + +list = [3,0,1,1,9,7] + +  + +$x = 7 + +$y = 2 + +$z = 3 + +  + +seen = Hash.new + +  + +list.permutation(3).to_a.each do |suba| + + if seen.has_key?(suba) + + next + + else + + seen[suba] = 1 + + x1 = list.find_index(suba[0]) + + x2 = list.find_index(suba[1]) + + x3 = list.find_index(suba[2]) + + if x1 > x2 || x2 > x3 || x1 > x3 + + next + + end + + if (suba[0] - suba[1]).abs > $x || (suba[1] - suba[2]).abs > $y || (suba[0] - suba[2]).abs > $z + + next + + else + + puts("#{suba}") + + end + + end + +end + +  + +=begin + +SAMPLE OUTPUT + +ruby .\GoodTriplets.rb + +[3, 0, 1] + +[3, 1, 1] + +[0, 1, 1] + +=end diff --git a/stats/pwc-challenge-187.json b/stats/pwc-challenge-187.json index 496b1e22e5..56b3d503d5 100644 --- a/stats/pwc-challenge-187.json +++ b/stats/pwc-challenge-187.json @@ -1,20 +1,8 @@ { - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "chart" : { - "type" : "column" - }, - "subtitle" : { - "text" : "[Champions: 36] Last updated at 2022-10-31 03:29:49 GMT" - }, - "legend" : { - "enabled" : 0 - }, - "xAxis" : { - "type" : "category" + "tooltip" : { + "pointFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", + "followPointer" : 1 }, "drilldown" : { "series" : [ @@ -47,7 +35,6 @@ ] }, { - "id" : "Arne Sommer", "name" : "Arne Sommer", "data" : [ [ @@ -58,9 +45,11 @@ "Blog", 1 ] - ] + ], + "id" : "Arne Sommer" }, { + "name" : "Athanasius", "data" : [ [ "Perl", @@ -71,18 +60,27 @@ 2 ] ], - "name" : "Athanasius", "id" : "Athanasius" }, { "data" : [ [ - "Raku", + "Perl", 2 ] ], + "name" : "Bob Lied", + "id" : "Bob Lied" + }, + { + "id" : "Bruce Gray", "name" : "Bruce Gray", - "id" : "Bruce Gray" + "data" : [ + [ + "Raku", + 2 + ] + ] }, { "id" : "Cheok-Yin Fung", @@ -105,47 +103,47 @@ "id" : "Colin Crain" }, { + "id" : "Dave Jacoby", "name" : "Dave Jacoby", "data" : [ [ "Perl", 2 ] - ], - "id" : "Dave Jacoby" + ] }, { - "id" : "Duncan C. White", "name" : "Duncan C. White", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Duncan C. White" }, { + "id" : "E. Choroba", "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "id" : "E. Choroba" + ] }, { - "id" : "Feng Chang", - "name" : "Feng Chang", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Feng Chang", + "id" : "Feng Chang" }, { - "id" : "Flavio Poletti", + "name" : "Flavio Poletti", "data" : [ [ "Perl", @@ -160,17 +158,17 @@ 2 ] ], - "name" : "Flavio Poletti" + "id" : "Flavio Poletti" }, { + "id" : "Humberto Massa", "data" : [ [ "Raku", 2 ] ], - "name" : "Humberto Massa", - "id" : "Humberto Massa" + "name" : "Humberto Massa" }, { "name" : "izem", @@ -183,6 +181,7 @@ "id" : "izem" }, { + "id" : "Jaldhar H. Vyas", "data" : [ [ "Perl", @@ -197,11 +196,9 @@ 1 ] ], - "name" : "Jaldhar H. Vyas", - "id" : "Jaldhar H. Vyas" + "name" : "Jaldhar H. Vyas" }, { - "id" : "James Smith", "name" : "James Smith", "data" : [ [ @@ -212,27 +209,28 @@ "Blog", 1 ] - ] + ], + "id" : "James Smith" }, { - "id" : "Jan Krnavek", + "name" : "Jan Krnavek", "data" : [ [ "Raku", 1 ] ], - "name" : "Jan Krnavek" + "id" : "Jan Krnavek" }, { + "id" : "Jorg Sommrey", "name" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ], - "id" : "Jorg Sommrey" + ] }, { "id" : "Laurent Rosenfeld", @@ -253,7 +251,7 @@ "name" : "Laurent Rosenfeld" }, { - "id" : "Luca Ferrari", + "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -264,27 +262,27 @@ 6 ] ], - "name" : "Luca Ferrari" + "id" : "Luca Ferrari" }, { + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson", - "id" : "Mark Anderson" + "name" : "Mark Anderson" }, { + "id" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] ], - "name" : "Matthew Neleigh", - "id" : "Matthew Neleigh" + "name" : "Matthew Neleigh" }, { "name" : "Mohammad S Anwar", @@ -302,26 +300,25 @@ }, { "id" : "Niels van Dijke", - "name" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Niels van Dijke" }, { + "id" : "Paul Fajman", + "name" : "Paul Fajman", "data" : [ [ "Perl", 2 ] - ], - "name" : "Paul Fajman", - "id" : "Paul Fajman" + ] }, { - "id" : "Peter Campbell Smith", "name" : "Peter Campbell Smith", "data" : [ [ @@ -332,19 +329,21 @@ "Blog", 1 ] - ] + ], + "id" : "Peter Campbell Smith" }, { "id" : "Robbie Hatley", - "name" : "Robbie Hatley", "data" : [ [ "Perl", 1 ] - ] + ], + "name" : "Robbie Hatley" }, { + "id" : "Robert DiCicco", "data" : [ [ "Perl", @@ -355,8 +354,7 @@ 2 ] ], - "name" : "Robert DiCicco", - "id" : "Robert DiCicco" + "name" : "Robert DiCicco" }, { "id" : "Robert Ransbottom", @@ -369,7 +367,7 @@ "name" : "Robert Ransbottom" }, { - "id" : "Roger Bell_West", + "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -384,10 +382,10 @@ 1 ] ], - "name" : "Roger Bell_West" + "id" : "Roger Bell_West" }, { - "id" : "Simon Green", + "name" : "Simon Green", "data" : [ [ "Perl", @@ -398,19 +396,20 @@ 1 ] ], - "name" : "Simon Green" + "id" : "Simon Green" }, { - "id" : "Solathian", - "name" : "Solathian", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Solathian", + "id" : "Solathian" }, { + "id" : "Stephen G. Lynn", "name" : "Stephen G. Lynn", "data" : [ [ @@ -425,21 +424,19 @@ "Blog", 1 ] - ], - "id" : "Stephen G. Lynn" + ] }, { "id" : "Tim Potapov", - "name" : "Tim Potapov", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Tim Potapov" }, { - "id" : "Ulrich Rieke", "name" : "Ulrich Rieke", "data" : [ [ @@ -450,9 +447,11 @@ "Raku", 2 ] - ] + ], + "id" : "Ulrich Rieke" }, { + "name" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -463,72 +462,64 @@ 1 ] ], - "name" : "W. Luis Mochan", "id" : "W. Luis Mochan" } ] }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "followPointer" : 1, - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 - } - }, "title" : { "text" : "The Weekly Challenge - 187" }, + "xAxis" : { + "type" : "category" + }, "series" : [ { - "colorByPoint" : 1, "name" : "The Weekly Challenge - 187", "data" : [ { "name" : "Adam Russell", - "y" : 4, - "drilldown" : "Adam Russell" + "drilldown" : "Adam Russell", + "y" : 4 }, { - "drilldown" : "Andinus", "y" : 2, + "drilldown" : "Andinus", "name" : "Andinus" }, { - "drilldown" : "Arne Sommer", + "name" : "Arne Sommer", "y" : 3, - "name" : "Arne Sommer" + "drilldown" : "Arne Sommer" }, { - "drilldown" : "Athanasius", "name" : "Athanasius", + "drilldown" : "Athanasius", "y" : 4 }, + { + "drilldown" : "Bob Lied", + "y" : 2, + "name" : "Bob Lied" + }, { "drilldown" : "Bruce Gray", "y" : 2, "name" : "Bruce Gray" }, { - "drilldown" : "Cheok-Yin Fung", "y" : 1, + "drilldown" : "Cheok-Yin Fung", "name" : "Cheok-Yin Fung" }, { + "drilldown" : "Colin Crain", "y" : 2, - "name" : "Colin Crain", - "drilldown" : "Colin Crain" + "name" : "Colin Crain" }, { - "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby", "y" : 2, - "drilldown" : "Dave Jacoby" + "name" : "Dave Jacoby" }, { "name" : "Duncan C. White", @@ -536,54 +527,54 @@ "drilldown" : "Duncan C. White" }, { - "drilldown" : "E. Choroba", "name" : "E. Choroba", + "drilldown" : "E. Choroba", "y" : 2 }, { + "drilldown" : "Feng Chang", "y" : 2, - "name" : "Feng Chang", - "drilldown" : "Feng Chang" + "name" : "Feng Chang" }, { - "name" : "Flavio Poletti", + "drilldown" : "Flavio Poletti", "y" : 6, - "drilldown" : "Flavio Poletti" + "name" : "Flavio Poletti" }, { - "name" : "Humberto Massa", + "drilldown" : "Humberto Massa", "y" : 2, - "drilldown" : "Humberto Massa" + "name" : "Humberto Massa" }, { - "y" : 2, "name" : "izem", - "drilldown" : "izem" + "drilldown" : "izem", + "y" : 2 }, { + "drilldown" : "Jaldhar H. Vyas", "y" : 5, - "name" : "Jaldhar H. Vyas", - "drilldown" : "Jaldhar H. Vyas" + "name" : "Jaldhar H. Vyas" }, { - "y" : 3, "name" : "James Smith", + "y" : 3, "drilldown" : "James Smith" }, { "y" : 1, - "name" : "Jan Krnavek", - "drilldown" : "Jan Krnavek" + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek" }, { - "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey", "y" : 2, - "name" : "Jorg Sommrey" + "drilldown" : "Jorg Sommrey" }, { + "name" : "Laurent Rosenfeld", "drilldown" : "Laurent Rosenfeld", - "y" : 5, - "name" : "Laurent Rosenfeld" + "y" : 5 }, { "drilldown" : "Luca Ferrari", @@ -591,29 +582,29 @@ "name" : "Luca Ferrari" }, { - "drilldown" : "Mark Anderson", "y" : 2, + "drilldown" : "Mark Anderson", "name" : "Mark Anderson" }, { - "drilldown" : "Matthew Neleigh", "name" : "Matthew Neleigh", + "drilldown" : "Matthew Neleigh", "y" : 2 }, { + "drilldown" : "Mohammad S Anwar", "y" : 4, - "name" : "Mohammad S Anwar", - "drilldown" : "Mohammad S Anwar" + "name" : "Mohammad S Anwar" }, { - "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke", "y" : 2, - "name" : "Niels van Dijke" + "drilldown" : "Niels van Dijke" }, { "y" : 2, - "name" : "Paul Fajman", - "drilldown" : "Paul Fajman" + "drilldown" : "Paul Fajman", + "name" : "Paul Fajman" }, { "drilldown" : "Peter Campbell Smith", @@ -621,23 +612,23 @@ "name" : "Peter Campbell Smith" }, { - "drilldown" : "Robbie Hatley", "y" : 1, + "drilldown" : "Robbie Hatley", "name" : "Robbie Hatley" }, { - "y" : 4, "name" : "Robert DiCicco", - "drilldown" : "Robert DiCicco" + "drilldown" : "Robert DiCicco", + "y" : 4 }, { + "name" : "Robert Ransbottom", "drilldown" : "Robert Ransbottom", - "y" : 2, - "name" : "Robert Ransbottom" + "y" : 2 }, { - "drilldown" : "Roger Bell_West", "y" : 5, + "drilldown" : "Roger Bell_West", "name" : "Roger Bell_West" }, { @@ -646,9 +637,9 @@ "drilldown" : "Simon Green" }, { - "drilldown" : "Solathian", + "name" : "Solathian", "y" : 2, - "name" : "Solathian" + "drilldown" : "Solathian" }, { "name" : "Stephen G. Lynn", @@ -656,21 +647,45 @@ "drilldown" : "Stephen G. Lynn" }, { + "name" : "Tim Potapov", "drilldown" : "Tim Potapov", - "y" : 2, - "name" : "Tim Potapov" + "y" : 2 }, { - "y" : 3, "name" : "Ulrich Rieke", + "y" : 3, "drilldown" : "Ulrich Rieke" }, { - "name" : "W. Luis Mochan", "y" : 3, - "drilldown" : "W. Luis Mochan" + "drilldown" : "W. Luis Mochan", + "name" : "W. Luis Mochan" } - ] + ], + "colorByPoint" : 1 + } + ], + "subtitle" : { + "text" : "[Champions: 37] Last updated at 2023-01-14 22:54:35 GMT" + }, + "legend" : { + "enabled" : 0 + }, + "chart" : { + "type" : "column" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } } - ] + } } diff --git a/stats/pwc-challenge-188.json b/stats/pwc-challenge-188.json index 7092deee0a..49b45b27ff 100644 --- a/stats/pwc-challenge-188.json +++ b/stats/pwc-challenge-188.json @@ -1,6 +1,8 @@ { - "xAxis" : { - "type" : "category" + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "plotOptions" : { "series" : { @@ -11,33 +13,24 @@ } } }, - "subtitle" : { - "text" : "[Champions: 41] Last updated at 2022-11-01 10:00:19 GMT" - }, - "tooltip" : { - "pointFormat" : "{point.name}: {point.y:f}
", - "followPointer" : 1, - "headerFormat" : "{series.name}
" - }, - "chart" : { - "type" : "column" - }, "title" : { "text" : "The Weekly Challenge - 188" }, + "xAxis" : { + "type" : "category" + }, "series" : [ { - "colorByPoint" : 1, "data" : [ { "name" : "Adam Russell", - "drilldown" : "Adam Russell", - "y" : 4 + "y" : 4, + "drilldown" : "Adam Russell" }, { + "name" : "Alexander Pankoff", "drilldown" : "Alexander Pankoff", - "y" : 2, - "name" : "Alexander Pankoff" + "y" : 2 }, { "name" : "Ali Moradi", @@ -45,14 +38,14 @@ "y" : 4 }, { - "y" : 2, "drilldown" : "Andinus", + "y" : 2, "name" : "Andinus" }, { - "name" : "Andrew Grangaard", "drilldown" : "Andrew Grangaard", - "y" : 2 + "y" : 2, + "name" : "Andrew Grangaard" }, { "drilldown" : "Arne Sommer", @@ -60,34 +53,39 @@ "name" : "Arne Sommer" }, { - "y" : 4, "drilldown" : "Athanasius", + "y" : 4, "name" : "Athanasius" }, { - "name" : "Cheok-Yin Fung", + "name" : "Bob Lied", "y" : 2, - "drilldown" : "Cheok-Yin Fung" + "drilldown" : "Bob Lie