From 2f83bdd6822c7c68c32ec6985b309e7f3612cf18 Mon Sep 17 00:00:00 2001 From: boblied Date: Wed, 3 Nov 2021 09:46:59 -0500 Subject: Challenge 1 solution, nested loops --- challenge-003/bob-lied/perl/ch-1.pl | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 challenge-003/bob-lied/perl/ch-1.pl diff --git a/challenge-003/bob-lied/perl/ch-1.pl b/challenge-003/bob-lied/perl/ch-1.pl new file mode 100644 index 0000000000..024fbed8f1 --- /dev/null +++ b/challenge-003/bob-lied/perl/ch-1.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-1.pl +#============================================================================= +# Copyright (c) 2021, Bob Lied +#============================================================================= +# Perl Weekly challenge Week 3, Challenge #1 +# Create a script to generate 5-smooth numbers, whose prime divisors are less +# or equal to 5. They are also called Hamming/Regular/Ugly numbers. For more +# information, please check this wikipedia. +# "... numbers are called 5-smooth, because they can be characterized as +# having only 2, 3, or 5 as prime factors. ..." +#============================================================================= + +use strict; +use warnings; +use v5.32; + +use experimental qw/ signatures /; +no warnings "experimental::signatures"; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +my $Max = shift; +$Max //= 100; + +sub fiveSmooth($max) +{ + my @smoothNumbers; + for ( my $mult2 = 1; $mult2 <= $max ; $mult2 *= 2 ) + { + for ( my $mult3 = $mult2 ; $mult3 <= $max ; $mult3 *= 3 ) + { + for ( my $mult5 = $mult3 ; $mult5 <= $max ; $mult5 *= 5 ) + { + push @smoothNumbers, $mult5 unless $mult5 == 1; # Not in order + } + } + } + return \@smoothNumbers; +} +exit(!runTest()) if $DoTest; +my $smoothList = fiveSmooth($Max); +say $_ foreach sort { $a <=> $b} @$smoothList; + +sub runTest +{ + use Test::More; + + is_deeply( fiveSmooth( 2), [ 2 ], "max = 2"); + is_deeply( fiveSmooth( 3), [ 2, 3 ], "max = 3"); + is_deeply( fiveSmooth( 5), [ 2, 3, 4, 5 ], "max = 5"); + is_deeply( fiveSmooth(10), [ 2, 3, 4, 5, 6, 8, 9, 10 ], "max = 10"); + is_deeply( fiveSmooth(20), [ 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20 ], "max = 20"); + + done_testing; +} + -- cgit From 05958e021f9a1368c83dbfe0b76c387d481f7fb6 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 8 Nov 2021 23:43:11 +0100 Subject: Tests for week 138 --- challenge-138/abigail/t/ctest.ini | 8 ++++++++ challenge-138/abigail/t/input-1-1 | 2 ++ challenge-138/abigail/t/input-2-1 | 3 +++ challenge-138/abigail/t/output-1-1.exp | 2 ++ challenge-138/abigail/t/output-2-1.exp | 3 +++ 5 files changed, 18 insertions(+) create mode 100644 challenge-138/abigail/t/ctest.ini create mode 100644 challenge-138/abigail/t/input-1-1 create mode 100644 challenge-138/abigail/t/input-2-1 create mode 100644 challenge-138/abigail/t/output-1-1.exp create mode 100644 challenge-138/abigail/t/output-2-1.exp diff --git a/challenge-138/abigail/t/ctest.ini b/challenge-138/abigail/t/ctest.ini new file mode 100644 index 0000000000..527781acbb --- /dev/null +++ b/challenge-138/abigail/t/ctest.ini @@ -0,0 +1,8 @@ +# +# Configuration file for running tests, using ctest. +# See https://github.com/Abigail/Misc/blob/master/ctest +# + +[names] +1-1 = Given Examples +2-1 = Given Examples diff --git a/challenge-138/abigail/t/input-1-1 b/challenge-138/abigail/t/input-1-1 new file mode 100644 index 0000000000..bedf748f35 --- /dev/null +++ b/challenge-138/abigail/t/input-1-1 @@ -0,0 +1,2 @@ +2021 +2020 diff --git a/challenge-138/abigail/t/input-2-1 b/challenge-138/abigail/t/input-2-1 new file mode 100644 index 0000000000..e388b97ecb --- /dev/null +++ b/challenge-138/abigail/t/input-2-1 @@ -0,0 +1,3 @@ +81 +9801 +36 diff --git a/challenge-138/abigail/t/output-1-1.exp b/challenge-138/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..dc9667c339 --- /dev/null +++ b/challenge-138/abigail/t/output-1-1.exp @@ -0,0 +1,2 @@ +261 +262 diff --git a/challenge-138/abigail/t/output-2-1.exp b/challenge-138/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..2f1465d159 --- /dev/null +++ b/challenge-138/abigail/t/output-2-1.exp @@ -0,0 +1,3 @@ +1 +1 +0 -- cgit From 8ac7ce4cd04ee377060f1d73f5169b680bfba190 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 8 Nov 2021 23:44:00 +0100 Subject: Perl solution for week 138, part 1 --- challenge-138/abigail/perl/ch-1.pl | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 challenge-138/abigail/perl/ch-1.pl diff --git a/challenge-138/abigail/perl/ch-1.pl b/challenge-138/abigail/perl/ch-1.pl new file mode 100644 index 0000000000..eae1bea355 --- /dev/null +++ b/challenge-138/abigail/perl/ch-1.pl @@ -0,0 +1,89 @@ +#!/opt/perl/bin/perl + +use 5.028; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-1.pl < input-file +# + +# +# A year can have 260, 261 or 262 workdays. +# +# Regular years start and end on the same day of the week. Which means +# that if Jan 1 is a workday, then Dec 31 is, and hence, the year has +# 261 workdays. If Jan 1 is a weekday, the year has 260 workdays. +# +# Leap years ends on a day which is one day later than the day of the +# week it starts on. So, if Jan 1 is Monday to Thursday, the year ends +# on a Tuesday to Friday, resulting in a year with 262 workdays. If the +# year starts on a Friday, it ends on a Saturday, giving 261 workdays. +# If the year starts on a Saturday, it ends on a Sunday, giving 260 workdays, +# and if the year starts on a Sunday, it ends on a Monday, giving 261 +# workdays. +# +# So, we could make a lookup table, based on the day of the week of +# Jan 1, and whether the year is a leap day or not. But we won't. Since +# last weeks challenge made us calculate the Doomsday value of the year, +# we will make a lookup table based on that. The Doomsday value is the +# day of the week on Jan 3 (regular years), or Jan 4 (leap years). +# +# This gives us the following table: +# +# +-------+----------+-------+----------+ +# | Regular Year | Leap Year | +# +----------------+-------+----------+-------+----------+ +# | Doomsday value | Jan 1 | Workdays | Jan 1 | Workdays | +# +----------------+-------+----------+-------+----------+ +# | 0 | Thu | 261 | Wed | 262 | +# | 1 | Fri | 261 | Thu | 262 | +# | 2 | Sat | 260 | Fri | 261 | +# | 3 | Sun | 260 | Sat | 260 | +# | 4 | Mon | 261 | Sun | 261 | +# | 5 | Tue | 261 | Mon | 262 | +# | 6 | Wed | 261 | Tue | 262 | +# +----------------+-------+----------+-------+----------+ + +my @lookup = ( + [261, 261, 260, 260, 261, 261, 261], # Regular years + [262, 262, 261, 260, 261, 262, 262], # Leap years +); + +my $SUNDAY = 0; +my $MONDAY = 1; +my $TUESDAY = 2; +my $WEDNESDAY = 3; +my $THURSDAY = 4; +my $FRIDAY = 5; +my $SATURDAY = 6; + +# +# Given a year, return its "Doomsday" value. +# 0 -> Sunday, 6 -> Saturday +# +sub doomsday ($year) { + use integer; + my $anchor = ($TUESDAY, $SUNDAY, $FRIDAY, $WEDNESDAY) [($year / 100) % 4]; + my $y = $year % 100; + my $doomsday = ((($y / 12) + ($y % 12) + (($y % 12) / 4)) + $anchor) % 7; + $doomsday; +} + +sub is_leap ($year) { + ($year % 400 == 0) || ($year % 4 == 0) && ($year % 100 != 0) ? 1 : 0 +} + + +while (<>) { + say $lookup [is_leap $_] [doomsday $_] +} -- cgit From 04bf8a1351c8d90860e2d5865779d85db3c60f50 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 8 Nov 2021 23:59:46 +0100 Subject: Perl solution for week 138, part 2 --- challenge-138/abigail/perl/ch-2.pl | 63 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 challenge-138/abigail/perl/ch-2.pl diff --git a/challenge-138/abigail/perl/ch-2.pl b/challenge-138/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..b9169688ee --- /dev/null +++ b/challenge-138/abigail/perl/ch-2.pl @@ -0,0 +1,63 @@ +#!/opt/perl/bin/perl + +use 5.028; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# See ../README.md +# + +# +# Run as: perl ch-2.pl < input-file +# + +# +# We solve this with a recursive function. "can_split" gets two arguments, +# '$target', the number we have to achieve as a sum of parts, and +# '$number', the number we have to split into parts. +# +# If $target exceeds $number, we return 0, as we cannot split a number into +# parts and have it sum to something larger. +# If $target equals $number, we return 1, as we can trivial fulfill this. +# +# Else, we take ever larger parts from the end, subtract that part from +# $target, and recurse. If no part succeeds, we have a failure. If any +# part succeeds, we have a winner. +# +# Note that the only two numbers where the sqrt is equal to itself are +# 0 and 1 -- we have to exclude those as we need to split the original +# number into at least two parts. For all other numbers, its square root +# will be less, so not splitting the original number can't sum to the +# square root. +# + +sub can_split ($target, $number) { + return 0 if $target > $number || $target < 0; + return 1 if $target == $number; + + my $pow_10 = 10; + # + # We could use substring instead of modolu and division, but modulo + # and division we can trivially port to other language solutions, + # while taking substrings requires more work. + # + while ($pow_10 < $number) { + use integer; + return 1 if can_split ($target - ($number % $pow_10), + $number / $pow_10); + $pow_10 *= 10; + } + + return 0; +} + +while (<>) { + chomp; + say $_ > 1 && can_split (sqrt ($_), $_) ? 1 : 0 +} -- cgit From 0d3206cbc7e17b6ad6a96e9d56b509543ed6132e Mon Sep 17 00:00:00 2001 From: boblied Date: Thu, 11 Nov 2021 12:06:33 -0600 Subject: PWC 138 Task #1 Workdays --- challenge-138/bob-lied/README | 4 +- challenge-138/bob-lied/perl/ch-1.pl | 101 ++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 challenge-138/bob-lied/perl/ch-1.pl diff --git a/challenge-138/bob-lied/README b/challenge-138/bob-lied/README index 1383134251..c231e3a589 100644 --- a/challenge-138/bob-lied/README +++ b/challenge-138/bob-lied/README @@ -1,3 +1,3 @@ -Solutions to weekly challenge 137 by Bob Lied +Solutions to weekly challenge 138 by Bob Lied -https://perlweeklychallenge.org/blog/perl-weekly-challenge-137/ +https://perlweeklychallenge.org/blog/perl-weekly-challenge-138/ diff --git a/challenge-138/bob-lied/perl/ch-1.pl b/challenge-138/bob-lied/perl/ch-1.pl new file mode 100644 index 0000000000..2ad0703e09 --- /dev/null +++ b/challenge-138/bob-lied/perl/ch-1.pl @@ -0,0 +1,101 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-1.pl +#============================================================================= +# Copyright (c) 2021, Bob Lied +#============================================================================= +# Perl Weekly Challenge, Week 138, Task #1 Workdays +# You are given a year, $year in 4-digits form. Write a script to calculate +# the total number of workdays in the given year. For the task, we consider, +# Monday - Friday as workdays. +#============================================================================= + +use strict; +use warnings; +use v5.32; + +use DateTime; + +use experimental qw/ signatures /; +no warnings "experimental::signatures"; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +# Assuming a modern Gregorian calendar of 365 or 366 days, +# with regular leap years, there are 52 weeks (52*7 = 364) +# of five work days, and one or two extra days. In a 365-day +# year, the 365th day will be the same day of the week as the +# 1st day. In a 366-day week, the two extra days will be the +# same day as 1st and 2nd.. +# +# So there are two cases. For 365-day years, a year that starts +# on a workday will end on the same workday, for a total of 261. +# A year that starts on Saturday or Sunday will end on Saturday +# or Sunday for a total of 260. +# +# For a leap year, if it starts on Monday through Thursday, days +# 365 and 366 will also be work days. If it starts on Friday, +# day 365 will be a work day, but 366 is on a Saturday. If it +# starts on Saturday, days 365 and 366 will be a weekend. If it +# starts on a Sunday, day 365 will be Sunday, but 366 will be +# a Monday. +# +# The extra days can be summarized in a 2x7 table, where the first +# index is 0 or 1 for leap year or not; and columns 1 to 7 correspond +# to days of the week with 1 == Monday. (Ignoring index 0 because +# this 1-through-7 is the way that DateTime counts.) + +my @extraDays = ( + # x M T W T F S S + [ 0, 1, 1, 1, 1, 1, 0, 0 ], # 0 == not a leap year + [ 0, 2, 2, 2, 2, 1, 0, 1 ], # 1 == leap year +); + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +exit(!runTest()) if $DoTest; + +my $Year = shift; +die "Usage: $0 YYYY" unless $Year; + +say workDays($Year); + + +sub isLeapYear($year) +{ + return ( ($year % 400 == 0) || ( $year % 4 == 0 && $year % 100 != 0 ) ) ? 1 : 0; +} + +sub workDays($year) +{ + my $jan1 = DateTime->new(year => $year, month => 1, day => 1); + my $dayOfWeek = $jan1->day_of_week(); # Returns 1==Monday, 7==Sunday + my $isLeapYear = isLeapYear($year); + return 260 + $extraDays[$isLeapYear][$dayOfWeek]; +} + +sub runTest +{ + use Test::More; + + is( workDays(1900), 261, "Monday 1900"); + is( workDays(2002), 261, "Tuesday 2002"); + is( workDays(2003), 261, "Wednesday 2003"); + is( workDays(2004), 262, "Thursday 2004"); + is( workDays(2021), 261, "Friday 2021"); + is( workDays(1938), 260, "Saturday 1938"); + is( workDays(1989), 260, "Sunday 1989"); + + is( workDays(1968), 262, "Monday 1968 LY"); + is( workDays(1952), 262, "Tuesday 1958 LY"); + is( workDays(1908), 262, "Wednesday 1908 LY"); + is( workDays(2004), 262, "Thursday 2004 LY"); + is( workDays(1960), 261, "Friday 1960 LY"); + is( workDays(1972), 260, "Saturday 1972 LY"); + is( workDays(1928), 261, "Sunday 1928 LY"); + + done_testing; +} + -- cgit From b8cab5c14dd26a4fea771051dae0d0aa8ad3a7a3 Mon Sep 17 00:00:00 2001 From: boblied Date: Thu, 11 Nov 2021 19:55:45 -0600 Subject: PWC 138 Task #2 Split Number --- challenge-138/bob-lied/perl/ch-2.pl | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 challenge-138/bob-lied/perl/ch-2.pl diff --git a/challenge-138/bob-lied/perl/ch-2.pl b/challenge-138/bob-lied/perl/ch-2.pl new file mode 100644 index 0000000000..b822cdc845 --- /dev/null +++ b/challenge-138/bob-lied/perl/ch-2.pl @@ -0,0 +1,89 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-2.pl +#============================================================================= +# Copyright (c) 2021, Bob Lied +#============================================================================= +# Perl Weekly Challenge, Week 138, TASK #2 › Split Number +# You are given a perfect square. Write a script to figure out if the square +# root the given number is same as sum of 2 or more splits of the given number. #============================================================================= + +use strict; +use warnings; +use v5.32; + +use experimental qw/ signatures /; +no warnings "experimental::signatures"; + +use List::Util; +use Data::Dumper; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +exit(!runTest()) if $DoTest; + +my $N = shift; + +sub _splitN($prefix, $rest, $sqrtN, $depth, $splits) +{ + my $tab = " " x ($depth*4); + my $len = length $rest; + for my $p ( 1 .. ($len-1) ) + { + my $pre = substr($rest, 0, $p); + my $rest = substr($rest, $p); + say STDERR "$tab [ $prefix ][ $pre ][ $rest ]" if $Verbose; + my $split = [ $prefix, $pre, $rest ]; + push @$splits, $split; + return 1 if List::Util::sum(@$split) == $sqrtN || + _splitN("$prefix$pre", $rest, $sqrtN, $depth+1, $splits) == 1; + + } +} + +sub splitNumber($n) +{ + my $sqrtN = sqrt($n); + my @splits; + my $len = length($n); + for my $p ( 1 .. ($len-1) ) + { + my $prefix = substr($n, 0, $p); + my $rest = substr($n, $p); + push @splits, [ $prefix, $rest ]; + say STDERR "[ $prefix ][ $rest ]" if $Verbose; + return 1 if ( ($prefix + $rest) == $sqrtN ) || + _splitN($prefix, $rest, $sqrtN, 1, \@splits) == 1; + + } + if ( $Verbose ) { say "@$_" for @splits; } + return 0; +} + +say splitNumber($N); + +#for my $n ( map { $_*$_ } ( 4..100 ) ) +#{ +# say "$n (", sqrt($n), ") ", splitNumber($n); +#} + +sub runTest +{ + use Test::More; + + is(splitNumber( 25), 0, "N = 25, 5 = __"); + is(splitNumber( 81), 1, "N = 81, 9 = 8 + 1"); + is(splitNumber( 100), 1, "N = 100, 10 = 10 + 0 + 0"); + is(splitNumber( 484), 0, "N = 484, 22 = __"); + is(splitNumber( 1296), 1, "N = 1296, 36 = 1 + 29 + 6"); + is(splitNumber( 4900), 0, "N = 4900, 70 = __"); + is(splitNumber( 9801), 1, "N = 9810, 99 = 98 + 1 + 0"); + is(splitNumber(10000), 1, "N = 10000, 100 = 100 + 0 + 0"); + + done_testing; +} + -- cgit From 14367fed2a21165238d2f14cd4f6506ff41dc2f1 Mon Sep 17 00:00:00 2001 From: boblied Date: Thu, 11 Nov 2021 20:00:00 -0600 Subject: PWC 138 Task #2 Split Number --- challenge-138/bob-lied/perl/ch-2.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-138/bob-lied/perl/ch-2.pl b/challenge-138/bob-lied/perl/ch-2.pl index b822cdc845..b54491bd96 100644 --- a/challenge-138/bob-lied/perl/ch-2.pl +++ b/challenge-138/bob-lied/perl/ch-2.pl @@ -30,7 +30,7 @@ my $N = shift; sub _splitN($prefix, $rest, $sqrtN, $depth, $splits) { - my $tab = " " x ($depth*4); + my $tab = " " x ($depth*4); # Debugging aid my $len = length $rest; for my $p ( 1 .. ($len-1) ) { -- cgit From b9f9a60c68f612e76a168ad9187273afff61f22c Mon Sep 17 00:00:00 2001 From: "Jaldhar H. Vyas" Date: Fri, 12 Nov 2021 02:03:44 -0500 Subject: Challenge 126 by Jaldhar H. Vyas. --- challenge-126/jaldhar-h-vyas/blog.txt | 1 + challenge-126/jaldhar-h-vyas/minesweeper.txt | 5 +++ challenge-126/jaldhar-h-vyas/perl/ch-1.sh | 3 ++ challenge-126/jaldhar-h-vyas/perl/ch-2.pl | 53 +++++++++++++++++++++++++++ challenge-126/jaldhar-h-vyas/raku/ch-1.sh | 3 ++ challenge-126/jaldhar-h-vyas/raku/ch-2.raku | 54 ++++++++++++++++++++++++++++ 6 files changed, 119 insertions(+) create mode 100644 challenge-126/jaldhar-h-vyas/blog.txt create mode 100644 challenge-126/jaldhar-h-vyas/minesweeper.txt create mode 100755 challenge-126/jaldhar-h-vyas/perl/ch-1.sh create mode 100755 challenge-126/jaldhar-h-vyas/perl/ch-2.pl create mode 100755 challenge-126/jaldhar-h-vyas/raku/ch-1.sh create mode 100755 challenge-126/jaldhar-h-vyas/raku/ch-2.raku diff --git a/challenge-126/jaldhar-h-vyas/blog.txt b/challenge-126/jaldhar-h-vyas/blog.txt new file mode 100644 index 0000000000..6e497fa2ad --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/blog.txt @@ -0,0 +1 @@ +https://www.braincells.com/perl/2021/11/perl_weekly_challenge_week_126.html diff --git a/challenge-126/jaldhar-h-vyas/minesweeper.txt b/challenge-126/jaldhar-h-vyas/minesweeper.txt new file mode 100644 index 0000000000..e451b4d36a --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/minesweeper.txt @@ -0,0 +1,5 @@ +x * * * x * x x x x +* * * * * * * * * x +* * * * x * x * x * +* * * x x * * * * * +x * * * x * * * * x \ No newline at end of file diff --git a/challenge-126/jaldhar-h-vyas/perl/ch-1.sh b/challenge-126/jaldhar-h-vyas/perl/ch-1.sh new file mode 100755 index 0000000000..cf7c003aa5 --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/perl/ch-1.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +perl -E 'say scalar grep { $_ !~ /1/ } 1 .. @ARGV[0];' $@ diff --git a/challenge-126/jaldhar-h-vyas/perl/ch-2.pl b/challenge-126/jaldhar-h-vyas/perl/ch-2.pl new file mode 100755 index 0000000000..5683cd9087 --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/perl/ch-2.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl +use 5.020; +use warnings; +use English qw/ -no_match_vars /; + +sub search { + my ($board) = @_; + + my $rowlast = scalar @{$board} - 1; + my $collast = scalar @{$board->[0]} - 1; + + for my $row (0 .. $rowlast) { + for my $col (0 .. $collast) { + if ($board->[$row]->[$col] == -1) { + for my $y ($row - 1 .. $row + 1) { + for my $x ($col - 1 .. $col + 1) { + if ($y < 0 || $y > $rowlast || $x < 0 || $x > $collast) { + next; + } + if ($board->[$y]->[$x] != -1) { + $board->[$y]->[$x]++; + } + } + } + } + } + } + return $board; +} + +sub output { + my ($board) = @_; + + for my $row (0 .. scalar @{$board} - 1) { + for my $col (0 .. scalar @{$board->[$row]} - 1) { + print $board->[$row]->[$col] == -1 ? 'x' : $board->[$row]->[$col], + ' '; + } + print "\n"; + } +} + +my $filename = shift // die "Need filename\n"; + +my @board; + +open my $fn, '<', $filename or die "$OS_ERROR\n"; +while (my $line = <$fn>) { + push @board, [ map { $_ eq '*' ? 0 : -1; } split q{ }, $line ]; +} +close $fn; + +output(search(\@board)); diff --git a/challenge-126/jaldhar-h-vyas/raku/ch-1.sh b/challenge-126/jaldhar-h-vyas/raku/ch-1.sh new file mode 100755 index 0000000000..631cda73c5 --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/raku/ch-1.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +raku -e '(1 .. @*ARGS[0]).grep({ $_ !~~ /1/ }).elems.say;' $@ diff --git a/challenge-126/jaldhar-h-vyas/raku/ch-2.raku b/challenge-126/jaldhar-h-vyas/raku/ch-2.raku new file mode 100755 index 0000000000..16a1c6e683 --- /dev/null +++ b/challenge-126/jaldhar-h-vyas/raku/ch-2.raku @@ -0,0 +1,54 @@ +#!/usr/bin/raku + +sub search(@board) { + my $rowlast = @board.elems - 1; + my $collast = @board[0].elems - 1; + + my @searched; + for 0 .. $rowlast -> $row { + for 0 .. $colmlast-> $col { + @searched[$row][$col] = @board[$row][$col]; + } + } + + for 0 .. $rowlast -> $row { + for 0 .. $colmlast-> $col { + if @board[$row][$col] == -1 { + for $row - 1 .. $row + 1 -> $y { + for $col - 1 .. $col + 1 -> $x { + if $y < 0 || $y > $rowlast || $x < 0 || $x > $colmlast{ + next; + } + + if @board[$y][$x] != -1 { + @searched[$y][$x]++; + } + } + } + } + } + } + + return @searched; +} + +sub output(@board) { + for 0 ..^ @board.elems -> $row { + for 0 ..^ @board[$row].elems -> $col { + print (@board[$row][$col] == -1 ?? 'x' !! @board[$row][$col]), ' '; + } + print "\n"; + } +} + +sub MAIN( + Str $filename +) { + my @board; + + for $filename.IO.lines -> $line { + @board.push($line.split(q{ }).map({ $_ eq '*' ?? 0 !! -1; })); + } + + @board ==> search() ==> output(); +} \ No newline at end of file -- cgit From 988363e0805ab6c321213ec09ebbc7e821105b3c Mon Sep 17 00:00:00 2001 From: E7-87-83 Date: Fri, 12 Nov 2021 16:27:09 +0800 Subject: correct Week number --- challenge-132/cheok-yin-fung/perl/ch-1.pl | 2 +- challenge-138/BLOG.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 challenge-138/BLOG.txt diff --git a/challenge-132/cheok-yin-fung/perl/ch-1.pl b/challenge-132/cheok-yin-fung/perl/ch-1.pl index ed95f49ea2..0247cfb9db 100644 --- a/challenge-132/cheok-yin-fung/perl/ch-1.pl +++ b/challenge-132/cheok-yin-fung/perl/ch-1.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -# The Weekly Challenge 131 +# The Weekly Challenge 132 # Task 1 Mirror Dates # Usage: ch-1.pl YYYY/MM/DD use v5.24.0; diff --git a/challenge-138/BLOG.txt b/challenge-138/BLOG.txt new file mode 100644 index 0000000000..470d7b5ebf --- /dev/null +++ b/challenge-138/BLOG.txt @@ -0,0 +1 @@ +https://e7-87-83.github.io/coding/challenge_138t1.html -- cgit From d00e3b49c7580928b6e32080bd3ce9f4f7d7bbac Mon Sep 17 00:00:00 2001 From: Paulo Custodio Date: Fri, 12 Nov 2021 08:40:21 +0000 Subject: Add Python solution to challenge 83 --- challenge-083/paulo-custodio/Makefile | 2 + challenge-083/paulo-custodio/perl/ch-1.pl | 8 ++-- challenge-083/paulo-custodio/perl/ch-2.pl | 10 +++-- challenge-083/paulo-custodio/python/ch-1.py | 23 +++++++++++ challenge-083/paulo-custodio/python/ch-2.py | 63 +++++++++++++++++++++++++++++ challenge-083/paulo-custodio/t/test-1.yaml | 10 +++++ challenge-083/paulo-custodio/t/test-2.yaml | 10 +++++ challenge-083/paulo-custodio/test.pl | 21 ---------- 8 files changed, 118 insertions(+), 29 deletions(-) create mode 100644 challenge-083/paulo-custodio/Makefile create mode 100644 challenge-083/paulo-custodio/python/ch-1.py create mode 100644 challenge-083/paulo-custodio/python/ch-2.py create mode 100644 challenge-083/paulo-custodio/t/test-1.yaml create mode 100644 challenge-083/paulo-custodio/t/test-2.yaml delete mode 100644 challenge-083/paulo-custodio/test.pl diff --git a/challenge-083/paulo-custodio/Makefile b/challenge-083/paulo-custodio/Makefile new file mode 100644 index 0000000000..c3c762d746 --- /dev/null +++ b/challenge-083/paulo-custodio/Makefile @@ -0,0 +1,2 @@ +all: + perl ../../challenge-001/paulo-custodio/test.pl diff --git a/challenge-083/paulo-custodio/perl/ch-1.pl b/challenge-083/paulo-custodio/perl/ch-1.pl index 597e65e4ea..31b52edb15 100644 --- a/challenge-083/paulo-custodio/perl/ch-1.pl +++ b/challenge-083/paulo-custodio/perl/ch-1.pl @@ -1,8 +1,8 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Challenge 083 # -# TASK #1 › Words Length +# TASK #1 > Words Length # Submitted by: Mohammad S Anwar # You are given a string $S with 3 or more words. # @@ -16,9 +16,9 @@ # Example 2: # Input: $S = "The purpose of our lives is to be happy" # -# Output: 23 +# Output: 29 use Modern::Perl; @ARGV >= 3 or die "need at least 3 words\n"; -say length(join('', @ARGV[1 .. $#ARGV-1])); +say length(join(' ', @ARGV[1 .. $#ARGV-1])); diff --git a/challenge-083/paulo-custodio/perl/ch-2.pl b/challenge-083/paulo-custodio/perl/ch-2.pl index 0332afc373..76e58cb9c9 100644 --- a/challenge-083/paulo-custodio/perl/ch-2.pl +++ b/challenge-083/paulo-custodio/perl/ch-2.pl @@ -1,8 +1,8 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Challenge 083 # -# TASK #2 › Flip Array +# TASK #2 > Flip Array # Submitted by: Mohammad S Anwar # You are given an array @A of positive numbers. # @@ -19,12 +19,14 @@ # Input: @A = (3, 10, 8) # Output: 1 # Explanation: -# Flipping the sign of just one element 10 gives the result 1 i.e. (3) + (-10) + (8) = 1 +# Flipping the sign of just one element 10 gives the result 1 i.e. +# (3) + (-10) + (8) = 1 # Example 2: # Input: @A = (12, 2, 10) # Output: 1 # Explanation: -# Flipping the sign of just one element 12 gives the result 0 i.e. (-12) + (2) + (10) = 0 +# Flipping the sign of just one element 12 gives the result 0 i.e. +# (-12) + (2) + (10) = 0 use Modern::Perl; diff --git a/challenge-083/paulo-custodio/python/ch-1.py b/challenge-083/paulo-custodio/python/ch-1.py new file mode 100644 index 0000000000..8fcedd0de9 --- /dev/null +++ b/challenge-083/paulo-custodio/python/ch-1.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# Challenge 083 +# +# TASK #1 > Words Length +# Submitted by: Mohammad S Anwar +# You are given a string $S with 3 or more words. +# +# Write a script to find the length of the string except the first and last +# words ignoring whitespace. +# +# Example 1: +# Input: $S = "The Weekly Challenge" +# +# Output: 6 +# Example 2: +# Input: $S = "The purpose of our lives is to be happy" +# +# Output: 29 + +import sys + +print(len(" ".join(sys.argv[2:-1]))) diff --git a/challenge-083/paulo-custodio/python/ch-2.py b/challenge-083/paulo-custodio/python/ch-2.py new file mode 100644 index 0000000000..9ae984375c --- /dev/null +++ b/challenge-083/paulo-custodio/python/ch-2.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +# Challenge 083 +# +# TASK #2 > Flip Array +# Submitted by: Mohammad S Anwar +# You are given an array @A of positive numbers. +# +# Write a script to flip the sign of some members of the given array so that +# the sum of the all members is minimum non-negative. +# +# Given an array of positive elements, you have to flip the sign of some of +# its elements such that the resultant sum of the elements of array should be +# minimum non-negative(as close to zero as possible). Return the minimum no. of +# elements whose sign needs to be flipped such that the resultant sum is minimum +# non-negative. +# +# Example 1: +# Input: @A = (3, 10, 8) +# Output: 1 +# Explanation: +# Flipping the sign of just one element 10 gives the result 1 i.e. +# (3) + (-10) + (8) = 1 +# Example 2: +# Input: @A = (12, 2, 10) +# Output: 1 +# Explanation: +# Flipping the sign of just one element 12 gives the result 0 i.e. +# (-12) + (2) + (10) = 0 + +import sys + +def sumprod(a, b): + sum = 0 + for i in range(len(a)): + sum += a[i]*b[i] + return sum + +# odometer-style sign flipper +def next_flip(sign): + for i in range(len(sign)): + if sign[i]==1: + sign[i]=-1 + return True + else: + sign[i]=1 + return False + +def count_flips(a): + # setup initial conditions + sign = [1 for x in a] + min_flips = 0 + min_sum = sumprod(a, sign) + + while next_flip(sign): + sum = sumprod(a, sign) + if sum >= 0: + flips = len(list(filter(lambda x: x==-1, sign))) + if sum < min_sum or (sum == min_sum and flips < min_flips): + min_sum, min_flips = sum, flips + return min_flips + +print(count_flips([int(x) for x in sys.argv[1:]])) diff --git a/challenge-083/paulo-custodio/t/test-1.yaml b/challenge-083/paulo-custodio/t/test-1.yaml new file mode 100644 index 0000000000..36c48df573 --- /dev/null +++ b/challenge-083/paulo-custodio/t/test-1.yaml @@ -0,0 +1,10 @@ +- setup: + cleanup: + args: The Weekly Challenge + input: + output: 6 +- setup: + cleanup: + args: The purpose of our lives is to be happy + input: + output: 29 diff --git a/challenge-083/paulo-custodio/t/test-2.yaml b/challenge-083/paulo-custodio/t/test-2.yaml new file mode 100644 index 0000000000..464f89fab1 --- /dev/null +++ b/challenge-083/paulo-custodio/t/test-2.yaml @@ -0,0 +1,10 @@ +- setup: + cleanup: + args: 3 10 8 + input: + output: 1 +- setup: + cleanup: + args: 12 2 10 + input: + output: 1 diff --git a/challenge-083/paulo-custodio/test.pl b/challenge-083/paulo-custodio/test.pl deleted file mode 100644 index a990681a37..0000000000 --- a/challenge-083/paulo-custodio/test.pl +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl - -use Modern::Perl; -use Test::More; - -is capture("perl/ch-1.pl The Weekly Challenge"), "6\n"; -is capture("perl/ch-1.pl The purpose of our lives is to be happy"), "23\n"; - - -is capture("perl/ch-2.pl 3 10 8"), "1\n"; -is capture("perl/ch-2.pl 12 2 10"), "1\n"; - - -done_testing; - -sub capture { - my($cmd) = @_; - my $out = `$cmd`; - $out =~ s/[ \t\v\f\r]*\n/\n/g; - return $out; -} -- cgit From c70500bec53c11544b5e8032606344dea15f58c8 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Fri, 12 Nov 2021 08:53:17 +0000 Subject: - Added solutions by Bob Lied. --- stats/pwc-current.json | 265 ++--- stats/pwc-language-breakdown-summary.json | 58 +- stats/pwc-language-breakdown.json | 1032 ++++++++++---------- stats/pwc-leaders.json | 734 +++++++------- stats/pwc-summary-1-30.json | 128 +-- stats/pwc-summary-121-150.json | 46 +- stats/pwc-summary-151-180.json | 96 +- stats/pwc-summary-181-210.json | 118 +-- stats/pwc-summary-211-240.json | 112 +-- stats/pwc-summary-241-270.json | 54 +- stats/pwc-summary-31-60.json | 110 +-- stats/pwc-summary-61-90.json | 100 +- stats/pwc-summary-91-120.json | 44 +- stats/pwc-summary.json | 1520 ++++++++++++++--------------- 14 files changed, 2216 insertions(+), 2201 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index d0f1a1ac5d..f7acdb9b55 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,104 +1,25 @@ { - "series" : [ - { - "colorByPoint" : 1, - "data" : [ - { - "y" : 1, - "drilldown" : "Andrew Shitov", - "name" : "Andrew Shitov" - }, - { - "y" : 3, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" - }, - { - "name" : "E. Choroba", - "drilldown" : "E. Choroba", - "y" : 2 - }, - { - "drilldown" : "James Smith", - "name" : "James Smith", - "y" : 3 - }, - { - "y" : 6, - "name" : "Luca Ferrari", - "drilldown" : "Luca Ferrari" - }, - { - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson", - "y" : 2 - }, - { - "name" : "Mohammad S Anwar", - "drilldown" : "Mohammad S Anwar", - "y" : 2 - }, - { - "drilldown" : "Paulo Custodio", - "name" : "Paulo Custodio", - "y" : 2 - }, - { - "name" : "Peter Campbell Smith", - "drilldown" : "Peter Campbell Smith", - "y" : 2 - }, - { - "y" : 2, - "name" : "Robert DiCicco", - "drilldown" : "Robert DiCicco" - }, - { - "y" : 4, - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West" - }, - { - "drilldown" : "Simon Green", - "name" : "Simon Green", - "y" : 3 - }, - { - "drilldown" : "Steven Wilson", - "name" : "Steven Wilson", - "y" : 2 - }, - { - "y" : 4, - "drilldown" : "Ulrich Rieke", - "name" : "Ulrich Rieke" - }, - { - "y" : 3, - "name" : "W. Luis Mochan", - "drilldown" : "W. Luis Mochan" - } - ], - "name" : "The Weekly Challenge - 138" + "yAxis" : { + "title" : { + "text" : "Total Solutions" } - ], - "legend" : { - "enabled" : 0 - }, - "subtitle" : { - "text" : "[Champions: 15] Last updated at 2021-11-12 01:04:38 GMT" }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { "enabled" : 1, "format" : "{point.y}" - }, - "borderWidth" : 0 + } } }, - "title" : { - "text" : "The Weekly Challenge - 138" + "tooltip" : { + "followPointer" : 1, + "headerFormat" : "{series.name}
", + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "subtitle" : { + "text" : "[Champions: 16] Last updated at 2021-11-12 08:51:19 GMT" }, "chart" : { "type" : "column" @@ -106,18 +27,31 @@ "xAxis" : { "type" : "category" }, + "legend" : { + "enabled" : 0 + }, "drilldown" : { "series" : [ { + "id" : "Andrew Shitov", "data" : [ [ "Raku", 1 ] ], - "id" : "Andrew Shitov", "name" : "Andrew Shitov" }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Bob Lied", + "name" : "Bob Lied" + }, { "data" : [ [ @@ -133,16 +67,17 @@ "name" : "Dave Jacoby" }, { + "name" : "E. Choroba", + "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "name" : "E. Choroba", - "id" : "E. Choroba" + ] }, { + "id" : "James Smith", "data" : [ [ "Perl", @@ -153,8 +88,7 @@ 1 ] ], - "name" : "James Smith", - "id" : "James Smith" + "name" : "James Smith" }, { "data" : [ @@ -167,22 +101,21 @@ 4 ] ], - "name" : "Luca Ferrari", - "id" : "Luca Ferrari" + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" }, { + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "id" : "Mark Anderson", - "name" : "Mark Anderson" + "id" : "Mark Anderson" }, { "id" : "Mohammad S Anwar", - "name" : "Mohammad S Anwar", "data" : [ [ "Perl", @@ -192,41 +125,41 @@ "Raku", 1 ] - ] + ], + "name" : "Mohammad S Anwar" }, { + "id" : "Paulo Custodio", "data" : [ [ "Perl", 2 ] ], - "name" : "Paulo Custodio", - "id" : "Paulo Custodio" + "name" : "Paulo Custodio" }, { + "id" : "Peter Campbell Smith", "data" : [ [ "Perl", 2 ] ], - "id" : "Peter Campbell Smith", "name" : "Peter Campbell Smith" }, { - "name" : "Robert DiCicco", - "id" : "Robert DiCicco", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Robert DiCicco", + "name" : "Robert DiCicco" }, { "name" : "Roger Bell_West", - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -236,9 +169,11 @@ "Raku", 2 ] - ] + ], + "id" : "Roger Bell_West" }, { + "id" : "Simon Green", "data" : [ [ "Perl", @@ -249,10 +184,10 @@ 1 ] ], - "id" : "Simon Green", "name" : "Simon Green" }, { + "id" : "Steven Wilson", "data" : [ [ "Perl", @@ -263,10 +198,10 @@ 1 ] ], - "id" : "Steven Wilson", "name" : "Steven Wilson" }, { + "name" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -277,8 +212,7 @@ 2 ] ], - "id" : "Ulrich Rieke", - "name" : "Ulrich Rieke" + "id" : "Ulrich Rieke" }, { "data" : [ @@ -291,19 +225,100 @@ 1 ] ], - "name" : "W. Luis Mochan", - "id" : "W. Luis Mochan" + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" } ] }, - "tooltip" : { - "followPointer" : 1, - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "drilldown" : "Andrew Shitov", + "y" : 1, + "name" : "Andrew Shitov" + }, + { + "drilldown" : "Bob Lied", + "y" : 2, + "name" : "Bob Lied" + }, + { + "y" : 3, + "name" : "Dave Jacoby", + "drilldown" : "Dave Jacoby" + }, + { + "drilldown" : "E. Choroba", + "name" : "E. Choroba", + "y" : 2 + }, + { + "drilldown" : "James Smith", + "name" : "James Smith", + "y" : 3 + }, + { + "drilldown" : "Luca Ferrari", + "y" : 6, + "name" : "Luca Ferrari" + }, + { + "drilldown" : "Mark Anderson", + "y" : 2, + "name" : "Mark Anderson" + }, + { + "drilldown" : "Mohammad S Anwar", + "y" : 2, + "name" : "Mohammad S Anwar" + }, + { + "name" : "Paulo Custodio", + "y" : 2, + "drilldown" : "Paulo Custodio" + }, + { + "drilldown" : "Peter Campbell Smith", + "y" : 2, + "name" : "Peter Campbell Smith" + }, + { + "y" : 2, + "name" : "Robert DiCicco", + "drilldown" : "Robert DiCicco" + }, + { + "drilldown" : "Roger Bell_West", + "y" : 4, + "name" : "Roger Bell_West" + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "y" : 2, + "name" : "Steven Wilson", + "drilldown" : "Steven Wilson" + }, + { + "name" : "Ulrich Rieke", + "y" : 4, + "drilldown" : "Ulrich Rieke" + }, + { + "y" : 3, + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 138" } + ], + "title" : { + "text" : "The Weekly Challenge - 138" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 0c472f43ee..6dc72c8553 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,25 +1,12 @@ { - "legend" : { - "enabled" : "false" - }, - "subtitle" : { - "text" : "Last updated at 2021-11-12 01:04:38 GMT" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, "series" : [ { - "dataLabels" : { - "rotation" : -90, - "enabled" : "true", - "align" : "right", - "y" : 10, - "color" : "#FFFFFF", - "format" : "{point.y:.0f}", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "name" : "Contributions", "data" : [ [ "Blog", @@ -27,32 +14,45 @@ ], [ "Perl", - 6607 + 6609 ], [ "Raku", 4004 ] - ] + ], + "dataLabels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "enabled" : "true", + "align" : "right", + "rotation" : -90, + "y" : 10, + "color" : "#FFFFFF", + "format" : "{point.y:.0f}" + }, + "name" : "Contributions" } ], - "yAxis" : { - "min" : 0, - "title" : { - "text" : null - } + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2021]" + }, + "subtitle" : { + "text" : "Last updated at 2021-11-12 08:51:19 GMT" }, "tooltip" : { "pointFormat" : "{point.y:.0f}" }, - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2021]" + "legend" : { + "enabled" : "false" }, "xAxis" : { "labels" : { "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" } }, "type" : "category" diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 4f4a9d04d0..d0ef3f7d05 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,31 +1,34 @@ { - "xAxis" : { - "type" : "category" - }, - "chart" : { - "type" : "column" - }, - "title" : { - "text" : "The Weekly Challenge Language" + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - } + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 } }, + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2021-11-12 08:51:19 GMT" + }, "tooltip" : { "headerFormat" : "", "followPointer" : "true", "pointFormat" : "Challenge {point.name}: {point.y:f}
" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "legend" : { + "enabled" : "false" + }, + "xAxis" : { + "type" : "category" + }, + "chart" : { + "type" : "column" }, "drilldown" : { "series" : [ @@ -48,8 +51,6 @@ "name" : "001" }, { - "name" : "002", - "id" : "002", "data" : [ [ "Perl", @@ -63,10 +64,11 @@ "Blog", 10 ] - ] + ], + "id" : "002", + "name" : "002" }, { - "id" : "003", "name" : "003", "data" : [ [ @@ -81,7 +83,8 @@ "Blog", 9 ] - ] + ], + "id" : "003" }, { "data" : [ @@ -98,10 +101,11 @@ 10 ] ], - "name" : "004", - "id" : "004" + "id" : "004", + "name" : "004" }, { + "id" : "005", "data" : [ [ "Perl", @@ -116,12 +120,9 @@ 12 ] ], - "name" : "005", - "id" : "005" + "name" : "005" }, { - "name" : "006", - "id" : "006", "data" : [ [ "Perl", @@ -135,11 +136,11 @@ "Blog", 7 ] - ] + ], + "id" : "006", + "name" : "006" }, { - "name" : "007", - "id" : "007", "data" : [ [ "Perl", @@ -153,7 +154,9 @@ "Blog", 10 ] - ] + ], + "id" : "007", + "name" : "007" }, { "name" : "008", @@ -174,8 +177,8 @@ ] }, { - "id" : "009", "name" : "009", + "id" : "009", "data" : [ [ "Perl", @@ -193,7 +196,6 @@ }, { "name" : "010", - "id" : "010", "data" : [ [ "Perl", @@ -207,11 +209,12 @@ "Blog", 11 ] - ] + ], + "id" : "010" }, { - "id" : "011", "name" : "011", + "id" : "011", "data" : [ [ "Perl", @@ -229,7 +232,6 @@ }, { "id" : "012", - "name" : "012", "data" : [ [ "Perl", @@ -243,9 +245,11 @@ "Blog", 11 ] - ] + ], + "name" : "012" }, { + "id" : "013", "data" : [ [ "Perl", @@ -260,12 +264,9 @@ 13 ] ], - "name" : "013", - "id" : "013" + "name" : "013" }, { - "id" : "014", - "name" : "014", "data" : [ [ "Perl", @@ -279,11 +280,12 @@ "Blog", 15 ] - ] + ], + "id" : "014", + "name" : "014" }, { "name" : "015", - "id" : "015", "data" : [ [ "Perl", @@ -297,7 +299,8 @@ "Blog", 15 ] - ] + ], + "id" : "015" }, { "data" : [ @@ -314,12 +317,10 @@ 12 ] ], - "name" : "016", - "id" : "016" + "id" : "016", + "name" : "016" }, { - "id" : "017", - "name" : "017", "data" : [ [ "Perl", @@ -333,9 +334,12 @@ "Blog", 12 ] - ] + ], + "id" : "017", + "name" : "017" }, { + "name" : "018", "data" : [ [ "Perl", @@ -350,12 +354,11 @@ 14 ] ], - "id" : "018", - "name" : "018" + "id" : "018" }, { - "id" : "019", "name" : "019", + "id" : "019", "data" : [ [ "Perl", @@ -373,7 +376,6 @@ }, { "id" : "020", - "name" : "020", "data" : [ [ "Perl", @@ -387,9 +389,12 @@ "Blog", 13 ] - ] + ], + "name" : "020" }, { + "name" : "021", + "id" : "021", "data" : [ [ "Perl", @@ -403,13 +408,9 @@ "Blog", 10 ] - ], - "id" : "021", - "name" : "021" + ] }, { - "id" : "022", - "name" : "022", "data" : [ [ "Perl", @@ -423,11 +424,12 @@ "Blog", 10 ] - ] + ], + "id" : "022", + "name" : "022" }, { "name" : "023", - "id" : "023", "data" : [ [ "Perl", @@ -441,10 +443,10 @@ "Blog", 12 ] - ] + ], + "id" : "023" }, { - "name" : "024", "id" : "024", "data" : [ [ @@ -459,9 +461,12 @@ "Blog", 11 ] - ] + ], + "name" : "024" }, { + "name" : "025", + "id" : "025", "data" : [ [ "Perl", @@ -475,13 +480,10 @@ "Blog", 12 ] - ], - "name" : "025", - "id" : "025" + ] }, { "name" : "026", - "id" : "026", "data" : [ [ "Perl", @@ -495,10 +497,10 @@ "Blog", 10 ] - ] + ], + "id" : "026" }, { - "id" : "027", "name" : "027", "data" : [ [ @@ -513,11 +515,10 @@ "Blog", 9 ] - ] + ], + "id" : "027" }, { - "name" : "028", - "id" : "028", "data" : [ [ "Perl", @@ -531,9 +532,13 @@ "Blog", 9 ] - ] + ], + "id" : "028", + "name" : "028" }, { + "name" : "029", + "id" : "029", "data" : [ [ "Perl", @@ -547,13 +552,9 @@ "Blog", 12 ] - ], - "name" : "029", - "id" : "029" + ] }, { - "name" : "030", - "id" : "030", "data" : [ [ "Perl", @@ -567,9 +568,12 @@ "Blog", 10 ] - ] + ], + "id" : "030", + "name" : "030" }, { + "id" : "031", "data" : [ [ "Perl", @@ -584,12 +588,10 @@ 9 ] ], - "name" : "031", - "id" : "031" + "name" : "031" }, { "name" : "032", - "id" : "032", "data" : [ [ "Perl", @@ -603,9 +605,11 @@ "Blog", 10 ] - ] + ], + "id" : "032" }, { + "name" : "033", "data" : [ [ "Perl", @@ -620,10 +624,11 @@ 10 ] ], - "id" : "033", - "name" : "033" + "id" : "033" }, { + "name" : "034", + "id" : "034", "data" : [ [ "Perl", @@ -637,9 +642,7 @@ "Blog", 11 ] - ], - "id" : "034", - "name" : "034" + ] }, { "name" : "035", @@ -660,7 +663,6 @@ ] }, { - "name" : "036", "id" : "036", "data" : [ [ @@ -675,9 +677,11 @@ "Blog", 11 ] - ] + ], + "name" : "036" }, { + "name" : "037", "data" : [ [ "Perl", @@ -692,10 +696,10 @@ 9 ] ], - "id" : "037", - "name" : "037" + "id" : "037" }, { + "name" : "038", "data" : [ [ "Perl", @@ -710,12 +714,9 @@ 12 ] ], - "id" : "038", - "name" : "038" + "id" : "038" }, { - "id" : "039", - "name" : "039", "data" : [ [ "Perl", @@ -729,9 +730,13 @@ "Blog", 12 ] - ] + ], + "id" : "039", + "name" : "039" }, { + "name" : "040", + "id" : "040", "data" : [ [ "Perl", @@ -745,9 +750,7 @@ "Blog", 10 ] - ], - "id" : "040", - "name" : "040" + ] }, { "data" : [ @@ -764,11 +767,10 @@ 9 ] ], - "name" : "041", - "id" : "041" + "id" : "041", + "name" : "041" }, { - "name" : "042", "id" : "042", "data" : [ [ @@ -783,9 +785,11 @@ "Blog", 11 ] - ] + ], + "name" : "042" }, { + "id" : "043", "data" : [ [ "Perl", @@ -800,10 +804,11 @@ 11 ] ], - "id" : "043", "name" : "043" }, { + "name" : "044", + "id" : "044", "data" : [ [ "Perl", @@ -817,12 +822,9 @@ "Blog", 11 ] - ], - "name" : "044", - "id" : "044" + ] }, { - "name" : "045", "id" : "045", "data" : [ [ @@ -837,9 +839,12 @@ "Blog", 11 ] - ] + ], + "name" : "045" }, { + "name" : "046", + "id" : "046", "data" : [ [ "Perl", @@ -853,13 +858,9 @@ "Blog", 10 ] - ], - "id" : "046", - "name" : "046" + ] }, { - "name" : "047", - "id" : "047", "data" : [ [ "Perl", @@ -873,10 +874,11 @@ "Blog", 10 ] - ] + ], + "id" : "047", + "name" : "047" }, { - "name" : "048", "id" : "048", "data" : [ [ @@ -891,11 +893,11 @@ "Blog", 12 ] - ] + ], + "name" : "048" }, { "id" : "049", - "name" : "049", "data" : [ [ "Perl", @@ -909,11 +911,11 @@ "Blog", 12 ] - ] + ], + "name" : "049" }, { "name" : "050", - "id" : "050", "data" : [ [ "Perl", @@ -927,11 +929,10 @@ "Blog", 12 ] - ] + ], + "id" : "050" }, { - "id" : "051", - "name" : "051", "data" : [ [ "Perl", @@ -945,9 +946,13 @@ "Blog", 11 ] - ] + ], + "id" : "051", + "name" : "051" }, { + "name" : "052", + "id" : "052", "data" : [ [ "Perl", @@ -961,13 +966,10 @@ "Blog", 14 ] - ], - "name" : "052", - "id" : "052" + ] }, { "id" : "053", - "name" : "053", "data" : [ [ "Perl", @@ -981,9 +983,11 @@ "Blog", 15 ] - ] + ], + "name" : "053" }, { + "name" : "054", "data" : [ [ "Perl", @@ -998,12 +1002,10 @@ 18 ] ], - "id" : "054", - "name" : "054" + "id" : "054" }, { "id" : "055", - "name" : "055", "data" : [ [ "Perl", @@ -1017,7 +1019,8 @@ "Blog", 14 ] - ] + ], + "name" : "055" }, { "data" : [ @@ -1038,7 +1041,6 @@ "name" : "056" }, { - "name" : "057", "id" : "057", "data" : [ [ @@ -1053,9 +1055,12 @@ "Blog", 15 ] - ] + ], + "name" : "057" }, { + "name" : "058", + "id" : "058", "data" : [ [ "Perl", @@ -1069,13 +1074,10 @@ "Blog", 13 ] - ], - "id" : "058", - "name" : "058" + ] }, { "id" : "059", - "name" : "059", "data" : [ [ "Perl", @@ -1089,10 +1091,10 @@ "Blog", 16 ] - ] + ], + "name" : "059" }, { - "id" : "060", "name" : "060", "data" : [ [ @@ -1107,10 +1109,10 @@ "Blog", 16 ] - ] + ], + "id" : "060" }, { -