From 6f77e37cd4c56a8be6a4e9cfa223039312b6ac5f Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 24 Jun 2019 03:03:05 +0100 Subject: - Added template folder for Challenge 014. --- challenge-014/aaron-sherman/README | 16 +++++++++++ challenge-014/abigail/README | 1 + challenge-014/adam-russell/README | 1 + challenge-014/ailbhe-tweedie/README | 1 + challenge-014/alex-daniel/README | 1 + challenge-014/alexander-karelas/README | 1 + challenge-014/alexey-melezhik/README | 1 + challenge-014/alicia-bielsa/README | 1 + challenge-014/andrezgz/README | 1 + challenge-014/antonio-gamiz/README | 1 + challenge-014/arne-sommer/README | 1 + challenge-014/arpad-toth/README | 1 + challenge-014/athanasius/README | 1 + challenge-014/aubrey-quarcoo/README | 1 + challenge-014/bill-palmer/README | 1 + challenge-014/bob-kleemann/README | 1 + challenge-014/cliveholloway/README | 1 + challenge-014/daniel-mantovani/README | 1 + challenge-014/daniel-mita/README | 1 + challenge-014/dave-cross/README | 1 + challenge-014/dave-jacoby/README | 1 + challenge-014/david-kayal/README | 1 + challenge-014/denis-yurashku/README | 1 + challenge-014/donald-hunter/README | 1 + challenge-014/doug-schrag/README | 1 + challenge-014/duncan-c-white/README | 39 ++++++++++++++++++++++++++ challenge-014/e-choroba/README | 1 + challenge-014/eddy-hs/README | 1 + challenge-014/feng-chang/README | 1 + challenge-014/finley/README | 1 + challenge-014/fjwhittle/README | 1 + challenge-014/fred-zinn/README | 1 + challenge-014/freddie-b/README | 1 + challenge-014/guillermo-ramos/README | 1 + challenge-014/gustavo-chaves/README | 1 + challenge-014/jacques-guinnebault/README | 1 + challenge-014/jaime/README | 42 ++++++++++++++++++++++++++++ challenge-014/jaldhar-h-vyas/README | 1 + challenge-014/jeff/README | 1 + challenge-014/jeremy-carman/README | 1 + challenge-014/jim-bacon/README | 1 + challenge-014/jj-merelo/README | 1 + challenge-014/jo-christian-oterhals/README | 1 + challenge-014/joe-tym/README | 1 + challenge-014/joelle-maslak/README | 1 + challenge-014/joelle-maslak/perl5/.gitignore | 1 + challenge-014/john-barrett/README | 1 + challenge-014/juan-caballero/README | 1 + challenge-014/kevin-colyer/README | 1 + challenge-014/khalid/README | 1 + challenge-014/kian-meng-ang/README | 1 + challenge-014/kivanc-yazan/README | 1 + challenge-014/lars-balker/README | 1 + challenge-014/laurent-rosenfeld/README | 1 + challenge-014/lubos-kolouch/README | 1 + challenge-014/magnus-woldrich/README | 1 + challenge-014/mano-chandar/README | 1 + challenge-014/mark-senn/README | 1 + challenge-014/martin-barth/README | 1 + challenge-014/martin-mugeni/README | 1 + challenge-014/matt-latusek/README | 1 + challenge-014/matthew-persico/README | 1 + challenge-014/maxim-kolodyazhny/README | 1 + challenge-014/maxim-nechaev/README | 1 + challenge-014/michael-schaap/README | 1 + challenge-014/neil-bowers/README | 1 + challenge-014/nick-logan/README | 1 + challenge-014/ohmycloud/README | 1 + challenge-014/oleksii-tsvietnov/README | 1 + challenge-014/ozzy/README | 1 + challenge-014/pavel-jurca/README | 1 + challenge-014/pavel-starikov/README | 1 + challenge-014/pete-houston/README | 1 + challenge-014/pete-sergeant/README | 1 + challenge-014/philippe-bruhat/README | 1 + challenge-014/prajith-p/README | 1 + challenge-014/rob4t/README | 1 + challenge-014/ruben-westerberg/README | 7 +++++ challenge-014/sean-meininger/README | 1 + challenge-014/sergiotarxz/README | 1 + challenge-014/shardiwal/README | 1 + challenge-014/simon-proctor/README | 1 + challenge-014/simon-reinhardt/README | 1 + challenge-014/steve-rogerson/README | 1 + challenge-014/steven-lembark/README | 1 + challenge-014/steven-wilson/README | 1 + challenge-014/tiago-stock/README | 1 + challenge-014/tim-smith/README | 1 + challenge-014/tore-andersson/README | 1 + challenge-014/uzluisf/README | 1 + challenge-014/veesh-goldman/README | 1 + challenge-014/william-gilmore/README | 1 + challenge-014/yary-h/README | 1 + challenge-014/yozen-hernandez/README | 1 + 94 files changed, 194 insertions(+) create mode 100644 challenge-014/aaron-sherman/README create mode 100644 challenge-014/abigail/README create mode 100644 challenge-014/adam-russell/README create mode 100644 challenge-014/ailbhe-tweedie/README create mode 100644 challenge-014/alex-daniel/README create mode 100644 challenge-014/alexander-karelas/README create mode 100644 challenge-014/alexey-melezhik/README create mode 100644 challenge-014/alicia-bielsa/README create mode 100644 challenge-014/andrezgz/README create mode 100644 challenge-014/antonio-gamiz/README create mode 100644 challenge-014/arne-sommer/README create mode 100644 challenge-014/arpad-toth/README create mode 100644 challenge-014/athanasius/README create mode 100644 challenge-014/aubrey-quarcoo/README create mode 100644 challenge-014/bill-palmer/README create mode 100644 challenge-014/bob-kleemann/README create mode 100644 challenge-014/cliveholloway/README create mode 100644 challenge-014/daniel-mantovani/README create mode 100644 challenge-014/daniel-mita/README create mode 100644 challenge-014/dave-cross/README create mode 100644 challenge-014/dave-jacoby/README create mode 100644 challenge-014/david-kayal/README create mode 100644 challenge-014/denis-yurashku/README create mode 100644 challenge-014/donald-hunter/README create mode 100644 challenge-014/doug-schrag/README create mode 100644 challenge-014/duncan-c-white/README create mode 100644 challenge-014/e-choroba/README create mode 100644 challenge-014/eddy-hs/README create mode 100644 challenge-014/feng-chang/README create mode 100644 challenge-014/finley/README create mode 100644 challenge-014/fjwhittle/README create mode 100644 challenge-014/fred-zinn/README create mode 100644 challenge-014/freddie-b/README create mode 100644 challenge-014/guillermo-ramos/README create mode 100644 challenge-014/gustavo-chaves/README create mode 100644 challenge-014/jacques-guinnebault/README create mode 100644 challenge-014/jaime/README create mode 100644 challenge-014/jaldhar-h-vyas/README create mode 100644 challenge-014/jeff/README create mode 100644 challenge-014/jeremy-carman/README create mode 100644 challenge-014/jim-bacon/README create mode 100644 challenge-014/jj-merelo/README create mode 100644 challenge-014/jo-christian-oterhals/README create mode 100644 challenge-014/joe-tym/README create mode 100644 challenge-014/joelle-maslak/README create mode 100644 challenge-014/joelle-maslak/perl5/.gitignore create mode 100644 challenge-014/john-barrett/README create mode 100644 challenge-014/juan-caballero/README create mode 100644 challenge-014/kevin-colyer/README create mode 100644 challenge-014/khalid/README create mode 100644 challenge-014/kian-meng-ang/README create mode 100644 challenge-014/kivanc-yazan/README create mode 100644 challenge-014/lars-balker/README create mode 100644 challenge-014/laurent-rosenfeld/README create mode 100644 challenge-014/lubos-kolouch/README create mode 100644 challenge-014/magnus-woldrich/README create mode 100644 challenge-014/mano-chandar/README create mode 100644 challenge-014/mark-senn/README create mode 100644 challenge-014/martin-barth/README create mode 100644 challenge-014/martin-mugeni/README create mode 100644 challenge-014/matt-latusek/README create mode 100644 challenge-014/matthew-persico/README create mode 100644 challenge-014/maxim-kolodyazhny/README create mode 100644 challenge-014/maxim-nechaev/README create mode 100644 challenge-014/michael-schaap/README create mode 100644 challenge-014/neil-bowers/README create mode 100644 challenge-014/nick-logan/README create mode 100644 challenge-014/ohmycloud/README create mode 100644 challenge-014/oleksii-tsvietnov/README create mode 100644 challenge-014/ozzy/README create mode 100644 challenge-014/pavel-jurca/README create mode 100644 challenge-014/pavel-starikov/README create mode 100644 challenge-014/pete-houston/README create mode 100644 challenge-014/pete-sergeant/README create mode 100644 challenge-014/philippe-bruhat/README create mode 100644 challenge-014/prajith-p/README create mode 100644 challenge-014/rob4t/README create mode 100644 challenge-014/ruben-westerberg/README create mode 100644 challenge-014/sean-meininger/README create mode 100644 challenge-014/sergiotarxz/README create mode 100644 challenge-014/shardiwal/README create mode 100644 challenge-014/simon-proctor/README create mode 100644 challenge-014/simon-reinhardt/README create mode 100644 challenge-014/steve-rogerson/README create mode 100644 challenge-014/steven-lembark/README create mode 100644 challenge-014/steven-wilson/README create mode 100644 challenge-014/tiago-stock/README create mode 100644 challenge-014/tim-smith/README create mode 100644 challenge-014/tore-andersson/README create mode 100644 challenge-014/uzluisf/README create mode 100644 challenge-014/veesh-goldman/README create mode 100644 challenge-014/william-gilmore/README create mode 100644 challenge-014/yary-h/README create mode 100644 challenge-014/yozen-hernandez/README (limited to 'challenge-014') diff --git a/challenge-014/aaron-sherman/README b/challenge-014/aaron-sherman/README new file mode 100644 index 0000000000..08d5ec39d2 --- /dev/null +++ b/challenge-014/aaron-sherman/README @@ -0,0 +1,16 @@ +Solutions by Aaron Sherman. + +Challenge #1: The first Euclid non-prime + +This puzzle afforded me the opportunity to advertize a bit for the +Math::Sequences module by showing how a new entry would be defined. + +It otherwise simply prints the solution number uninterestingly. + +Challenge #2: Common path prefixes + +I thought that this would be a good chance to show off Perl 6's +user-defined operator features including the use of a user-defined +operator in a reduction meta-operator. + +The use of the program is simple and can be shown using --help diff --git a/challenge-014/abigail/README b/challenge-014/abigail/README new file mode 100644 index 0000000000..5f0d73ae16 --- /dev/null +++ b/challenge-014/abigail/README @@ -0,0 +1 @@ +Solution by Abigail diff --git a/challenge-014/adam-russell/README b/challenge-014/adam-russell/README new file mode 100644 index 0000000000..9420c9a781 --- /dev/null +++ b/challenge-014/adam-russell/README @@ -0,0 +1 @@ +Solution by Adam Russell diff --git a/challenge-014/ailbhe-tweedie/README b/challenge-014/ailbhe-tweedie/README new file mode 100644 index 0000000000..36d4034b70 --- /dev/null +++ b/challenge-014/ailbhe-tweedie/README @@ -0,0 +1 @@ +Solution by Ailbhe Tweedie diff --git a/challenge-014/alex-daniel/README b/challenge-014/alex-daniel/README new file mode 100644 index 0000000000..65550789bd --- /dev/null +++ b/challenge-014/alex-daniel/README @@ -0,0 +1 @@ +Solution by Alex Daniel. diff --git a/challenge-014/alexander-karelas/README b/challenge-014/alexander-karelas/README new file mode 100644 index 0000000000..3de9fce8d9 --- /dev/null +++ b/challenge-014/alexander-karelas/README @@ -0,0 +1 @@ +Solution by Alexander Karelas diff --git a/challenge-014/alexey-melezhik/README b/challenge-014/alexey-melezhik/README new file mode 100644 index 0000000000..ca7008f224 --- /dev/null +++ b/challenge-014/alexey-melezhik/README @@ -0,0 +1 @@ +Solution by Alexey Melezhik diff --git a/challenge-014/alicia-bielsa/README b/challenge-014/alicia-bielsa/README new file mode 100644 index 0000000000..c5187874c3 --- /dev/null +++ b/challenge-014/alicia-bielsa/README @@ -0,0 +1 @@ +Solution by Alicia Beilsa. diff --git a/challenge-014/andrezgz/README b/challenge-014/andrezgz/README new file mode 100644 index 0000000000..f4fd0da88e --- /dev/null +++ b/challenge-014/andrezgz/README @@ -0,0 +1 @@ +Solution by Andrezgz diff --git a/challenge-014/antonio-gamiz/README b/challenge-014/antonio-gamiz/README new file mode 100644 index 0000000000..1f5ed5871a --- /dev/null +++ b/challenge-014/antonio-gamiz/README @@ -0,0 +1 @@ +Solution by Antonio Gamiz diff --git a/challenge-014/arne-sommer/README b/challenge-014/arne-sommer/README new file mode 100644 index 0000000000..b5d88e4df4 --- /dev/null +++ b/challenge-014/arne-sommer/README @@ -0,0 +1 @@ +Solution by Arne Sommer. diff --git a/challenge-014/arpad-toth/README b/challenge-014/arpad-toth/README new file mode 100644 index 0000000000..6661dd82c1 --- /dev/null +++ b/challenge-014/arpad-toth/README @@ -0,0 +1 @@ +Solution by Arpad Toth diff --git a/challenge-014/athanasius/README b/challenge-014/athanasius/README new file mode 100644 index 0000000000..cc357fda4a --- /dev/null +++ b/challenge-014/athanasius/README @@ -0,0 +1 @@ +Solution by Athanasius diff --git a/challenge-014/aubrey-quarcoo/README b/challenge-014/aubrey-quarcoo/README new file mode 100644 index 0000000000..8e63a2c1f5 --- /dev/null +++ b/challenge-014/aubrey-quarcoo/README @@ -0,0 +1 @@ +Solution by Aubrey Quarcoo diff --git a/challenge-014/bill-palmer/README b/challenge-014/bill-palmer/README new file mode 100644 index 0000000000..08ec849a41 --- /dev/null +++ b/challenge-014/bill-palmer/README @@ -0,0 +1 @@ +Solution by Bill Palmer. diff --git a/challenge-014/bob-kleemann/README b/challenge-014/bob-kleemann/README new file mode 100644 index 0000000000..78680e4035 --- /dev/null +++ b/challenge-014/bob-kleemann/README @@ -0,0 +1 @@ +Solution by Bob Kleemann diff --git a/challenge-014/cliveholloway/README b/challenge-014/cliveholloway/README new file mode 100644 index 0000000000..b69201296e --- /dev/null +++ b/challenge-014/cliveholloway/README @@ -0,0 +1 @@ +Solution by Clive Holloway diff --git a/challenge-014/daniel-mantovani/README b/challenge-014/daniel-mantovani/README new file mode 100644 index 0000000000..ed538216f2 --- /dev/null +++ b/challenge-014/daniel-mantovani/README @@ -0,0 +1 @@ +Solution by Daniel Mantovani diff --git a/challenge-014/daniel-mita/README b/challenge-014/daniel-mita/README new file mode 100644 index 0000000000..37339f491f --- /dev/null +++ b/challenge-014/daniel-mita/README @@ -0,0 +1 @@ +Solution by Daniel Mita diff --git a/challenge-014/dave-cross/README b/challenge-014/dave-cross/README new file mode 100644 index 0000000000..04b1b0623b --- /dev/null +++ b/challenge-014/dave-cross/README @@ -0,0 +1 @@ +Solution by Dave Cross diff --git a/challenge-014/dave-jacoby/README b/challenge-014/dave-jacoby/README new file mode 100644 index 0000000000..7c06689f16 --- /dev/null +++ b/challenge-014/dave-jacoby/README @@ -0,0 +1 @@ +Solution by Dave Jacoby diff --git a/challenge-014/david-kayal/README b/challenge-014/david-kayal/README new file mode 100644 index 0000000000..66f8615260 --- /dev/null +++ b/challenge-014/david-kayal/README @@ -0,0 +1 @@ +Solution by David Kayal diff --git a/challenge-014/denis-yurashku/README b/challenge-014/denis-yurashku/README new file mode 100644 index 0000000000..2fea994000 --- /dev/null +++ b/challenge-014/denis-yurashku/README @@ -0,0 +1 @@ +Solutions by Denis Yurashku. diff --git a/challenge-014/donald-hunter/README b/challenge-014/donald-hunter/README new file mode 100644 index 0000000000..2eef878f17 --- /dev/null +++ b/challenge-014/donald-hunter/README @@ -0,0 +1 @@ +Solutions by Donald Hunter. diff --git a/challenge-014/doug-schrag/README b/challenge-014/doug-schrag/README new file mode 100644 index 0000000000..bf8a10ffb4 --- /dev/null +++ b/challenge-014/doug-schrag/README @@ -0,0 +1 @@ +Solution by Doug Schrag diff --git a/challenge-014/duncan-c-white/README b/challenge-014/duncan-c-white/README new file mode 100644 index 0000000000..818ecf50b2 --- /dev/null +++ b/challenge-014/duncan-c-white/README @@ -0,0 +1,39 @@ +Challenge 1: "Write a script to print the date of last Friday of every +month of a given year. For example, if the given year is 2019 then it +should print the following: + +2019/01/25 +2019/02/22 +2019/03/29 +2019/04/26 +2019/05/31 +2019/06/28 +2019/07/26 +2019/08/30 +2019/09/27 +2019/10/25 +2019/11/29 +2019/12/27 + + +My notes: + +Date::Manip should be able to do that easily enough. + + +Challenge 2: Write a script to demonstrate Mutually Recursive methods. Two +methods are mutually recursive if the first method calls the second and +the second calls first in turn. Using the mutually recursive methods, +generate Hofstadter Female and Male sequences. + + F ( 0 ) = 1 ; M ( 0 ) = 0 + F ( n ) = n - M ( F ( n - 1 ) ) , n > 0 + M ( n ) = n - F ( M ( n - 1 ) ) , n > 0." + + + My notes: + + Ok, looks straight forward enough, and I always liked Douglas Hofstadter + and especially his book Godel, Esher and Bach. Initially, I did it as + straightforward mutually recursive functions, but then I added Memoize + optimization when I realized how slow it gets as N increases (eg to 80..).. diff --git a/challenge-014/e-choroba/README b/challenge-014/e-choroba/README new file mode 100644 index 0000000000..efff637bcb --- /dev/null +++ b/challenge-014/e-choroba/README @@ -0,0 +1 @@ +Solutions by E. Choroba. diff --git a/challenge-014/eddy-hs/README b/challenge-014/eddy-hs/README new file mode 100644 index 0000000000..0ed51d222d --- /dev/null +++ b/challenge-014/eddy-hs/README @@ -0,0 +1 @@ +Solution by Eddy HS diff --git a/challenge-014/feng-chang/README b/challenge-014/feng-chang/README new file mode 100644 index 0000000000..74e56de3ed --- /dev/null +++ b/challenge-014/feng-chang/README @@ -0,0 +1 @@ +Solutions by Feng Chang. diff --git a/challenge-014/finley/README b/challenge-014/finley/README new file mode 100644 index 0000000000..f08a121076 --- /dev/null +++ b/challenge-014/finley/README @@ -0,0 +1 @@ +Solution by Finley diff --git a/challenge-014/fjwhittle/README b/challenge-014/fjwhittle/README new file mode 100644 index 0000000000..7dcc95e189 --- /dev/null +++ b/challenge-014/fjwhittle/README @@ -0,0 +1 @@ +Solution by Francis Whittle diff --git a/challenge-014/fred-zinn/README b/challenge-014/fred-zinn/README new file mode 100644 index 0000000000..17bac4f094 --- /dev/null +++ b/challenge-014/fred-zinn/README @@ -0,0 +1 @@ +Solution by Fred Zinn diff --git a/challenge-014/freddie-b/README b/challenge-014/freddie-b/README new file mode 100644 index 0000000000..823d7474b5 --- /dev/null +++ b/challenge-014/freddie-b/README @@ -0,0 +1 @@ +Solution by Freddie B diff --git a/challenge-014/guillermo-ramos/README b/challenge-014/guillermo-ramos/README new file mode 100644 index 0000000000..a39eb01bff --- /dev/null +++ b/challenge-014/guillermo-ramos/README @@ -0,0 +1 @@ +Solution by Guillermo Ramos. diff --git a/challenge-014/gustavo-chaves/README b/challenge-014/gustavo-chaves/README new file mode 100644 index 0000000000..a66bbbf8a3 --- /dev/null +++ b/challenge-014/gustavo-chaves/README @@ -0,0 +1 @@ +Solution by Gustavo Chaves diff --git a/challenge-014/jacques-guinnebault/README b/challenge-014/jacques-guinnebault/README new file mode 100644 index 0000000000..9d3e7c037f --- /dev/null +++ b/challenge-014/jacques-guinnebault/README @@ -0,0 +1 @@ +Solution by Jacques Guinnebault. diff --git a/challenge-014/jaime/README b/challenge-014/jaime/README new file mode 100644 index 0000000000..6b98f9b732 --- /dev/null +++ b/challenge-014/jaime/README @@ -0,0 +1,42 @@ +Solution by Jaime Corchado, (@tortsnare)[https://twitter.com/tortsnare]. + +# Challenge #1 + +The numbers formed by adding one to the products of the smallest +primes are called the Euclid Numbers (see wiki). Write a script that +finds the smallest Euclid Number that is not prime. + +## Solution + +Calculate the product of prime numbers and check if each successor is a prime. + +# Challenge #2 + +Write a script that finds the common directory path, given a +collection of paths and directory separator. For example, if the +following paths are supplied. + +``` +/a/b/c/d +/a/b/cd +/a/b/cc +/a/b/c/d/e +``` + +and the path separator is `/`. Your script should return `/a/b` as common +directory path. + +## Solution + +``` +perl -- ch-2.pl <*delimiter*> <*list of strings*> +``` + +The path *delimiter* is a string like `/`. +The *list of strings* is a string like `/usr/bin:/usr/sbin`. + +The solution is to find the consecutive intersection of all paths. + +# Challenge #3 + +Find out the synonyms of a given word using the Synonyms API. diff --git a/challenge-014/jaldhar-h-vyas/README b/challenge-014/jaldhar-h-vyas/README new file mode 100644 index 0000000000..7dce927eca --- /dev/null +++ b/challenge-014/jaldhar-h-vyas/README @@ -0,0 +1 @@ +Solution by Jaldhar H. Vyas diff --git a/challenge-014/jeff/README b/challenge-014/jeff/README new file mode 100644 index 0000000000..d5f15f4a8e --- /dev/null +++ b/challenge-014/jeff/README @@ -0,0 +1 @@ +Solution by Jeff diff --git a/challenge-014/jeremy-carman/README b/challenge-014/jeremy-carman/README new file mode 100644 index 0000000000..3d08510e49 --- /dev/null +++ b/challenge-014/jeremy-carman/README @@ -0,0 +1 @@ +Solution by Jeremy Carman diff --git a/challenge-014/jim-bacon/README b/challenge-014/jim-bacon/README new file mode 100644 index 0000000000..8dcfd637a3 --- /dev/null +++ b/challenge-014/jim-bacon/README @@ -0,0 +1 @@ +Solution by Jim Bacon diff --git a/challenge-014/jj-merelo/README b/challenge-014/jj-merelo/README new file mode 100644 index 0000000000..d09838676b --- /dev/null +++ b/challenge-014/jj-merelo/README @@ -0,0 +1 @@ +Solution by JJ Merelo diff --git a/challenge-014/jo-christian-oterhals/README b/challenge-014/jo-christian-oterhals/README new file mode 100644 index 0000000000..eafff999fb --- /dev/null +++ b/challenge-014/jo-christian-oterhals/README @@ -0,0 +1 @@ +Solution by Jo Christian Oterhals diff --git a/challenge-014/joe-tym/README b/challenge-014/joe-tym/README new file mode 100644 index 0000000000..4e2d1b704f --- /dev/null +++ b/challenge-014/joe-tym/README @@ -0,0 +1 @@ +Solutions by Joe Tym. diff --git a/challenge-014/joelle-maslak/README b/challenge-014/joelle-maslak/README new file mode 100644 index 0000000000..d12c7940c3 --- /dev/null +++ b/challenge-014/joelle-maslak/README @@ -0,0 +1 @@ +Solution by Joelle Maslak diff --git a/challenge-014/joelle-maslak/perl5/.gitignore b/challenge-014/joelle-maslak/perl5/.gitignore new file mode 100644 index 0000000000..714f73c541 --- /dev/null +++ b/challenge-014/joelle-maslak/perl5/.gitignore @@ -0,0 +1 @@ +_Inline diff --git a/challenge-014/john-barrett/README b/challenge-014/john-barrett/README new file mode 100644 index 0000000000..a7ff0af641 --- /dev/null +++ b/challenge-014/john-barrett/README @@ -0,0 +1 @@ +Solution by John Barrett diff --git a/challenge-014/juan-caballero/README b/challenge-014/juan-caballero/README new file mode 100644 index 0000000000..bffe4b05c2 --- /dev/null +++ b/challenge-014/juan-caballero/README @@ -0,0 +1 @@ +Solution by Juan Caballero diff --git a/challenge-014/kevin-colyer/README b/challenge-014/kevin-colyer/README new file mode 100644 index 0000000000..32aa940083 --- /dev/null +++ b/challenge-014/kevin-colyer/README @@ -0,0 +1 @@ +Solutions by Kevin Colyer. diff --git a/challenge-014/khalid/README b/challenge-014/khalid/README new file mode 100644 index 0000000000..1ca4211368 --- /dev/null +++ b/challenge-014/khalid/README @@ -0,0 +1 @@ +Solution by Khalid diff --git a/challenge-014/kian-meng-ang/README b/challenge-014/kian-meng-ang/README new file mode 100644 index 0000000000..a5f0359813 --- /dev/null +++ b/challenge-014/kian-meng-ang/README @@ -0,0 +1 @@ +Solution by Kian-Meng Ang diff --git a/challenge-014/kivanc-yazan/README b/challenge-014/kivanc-yazan/README new file mode 100644 index 0000000000..bc7f8ca509 --- /dev/null +++ b/challenge-014/kivanc-yazan/README @@ -0,0 +1 @@ +Solution by Kivanc Yazan diff --git a/challenge-014/lars-balker/README b/challenge-014/lars-balker/README new file mode 100644 index 0000000000..054649c9eb --- /dev/null +++ b/challenge-014/lars-balker/README @@ -0,0 +1 @@ +Solution by Lars Balker diff --git a/challenge-014/laurent-rosenfeld/README b/challenge-014/laurent-rosenfeld/README new file mode 100644 index 0000000000..f9c6e1437e --- /dev/null +++ b/challenge-014/laurent-rosenfeld/README @@ -0,0 +1 @@ +Solution by Laurent Rosenfeld diff --git a/challenge-014/lubos-kolouch/README b/challenge-014/lubos-kolouch/README new file mode 100644 index 0000000000..921b2d9f4a --- /dev/null +++ b/challenge-014/lubos-kolouch/README @@ -0,0 +1 @@ +Solutions by Lubos Kolouch. diff --git a/challenge-014/magnus-woldrich/README b/challenge-014/magnus-woldrich/README new file mode 100644 index 0000000000..79cde2997c --- /dev/null +++ b/challenge-014/magnus-woldrich/README @@ -0,0 +1 @@ +Solution by Magnus Woldrich diff --git a/challenge-014/mano-chandar/README b/challenge-014/mano-chandar/README new file mode 100644 index 0000000000..2ec028460a --- /dev/null +++ b/challenge-014/mano-chandar/README @@ -0,0 +1 @@ +Solutions by Mano Chandar. diff --git a/challenge-014/mark-senn/README b/challenge-014/mark-senn/README new file mode 100644 index 0000000000..f37c93431c --- /dev/null +++ b/challenge-014/mark-senn/README @@ -0,0 +1 @@ +Solution by Mark Senn diff --git a/challenge-014/martin-barth/README b/challenge-014/martin-barth/README new file mode 100644 index 0000000000..13c469f3c3 --- /dev/null +++ b/challenge-014/martin-barth/README @@ -0,0 +1 @@ +Solutions by Martin Barth. diff --git a/challenge-014/martin-mugeni/README b/challenge-014/martin-mugeni/README new file mode 100644 index 0000000000..416ca98166 --- /dev/null +++ b/challenge-014/martin-mugeni/README @@ -0,0 +1 @@ +Solution by Martin Mugeni diff --git a/challenge-014/matt-latusek/README b/challenge-014/matt-latusek/README new file mode 100644 index 0000000000..e1dc8b6e16 --- /dev/null +++ b/challenge-014/matt-latusek/README @@ -0,0 +1 @@ +Solution by Matt Latusek. diff --git a/challenge-014/matthew-persico/README b/challenge-014/matthew-persico/README new file mode 100644 index 0000000000..5aa5622296 --- /dev/null +++ b/challenge-014/matthew-persico/README @@ -0,0 +1 @@ +Solutions by Matthew O. Persico. diff --git a/challenge-014/maxim-kolodyazhny/README b/challenge-014/maxim-kolodyazhny/README new file mode 100644 index 0000000000..e5b4df7154 --- /dev/null +++ b/challenge-014/maxim-kolodyazhny/README @@ -0,0 +1 @@ +Solution by Maxim Kolodyazhny diff --git a/challenge-014/maxim-nechaev/README b/challenge-014/maxim-nechaev/README new file mode 100644 index 0000000000..0695cbfa4d --- /dev/null +++ b/challenge-014/maxim-nechaev/README @@ -0,0 +1 @@ +Solutions by Maxim Nechaev. diff --git a/challenge-014/michael-schaap/README b/challenge-014/michael-schaap/README new file mode 100644 index 0000000000..db803c5d87 --- /dev/null +++ b/challenge-014/michael-schaap/README @@ -0,0 +1 @@ +Solution by Michael Schaap diff --git a/challenge-014/neil-bowers/README b/challenge-014/neil-bowers/README new file mode 100644 index 0000000000..9d446303df --- /dev/null +++ b/challenge-014/neil-bowers/README @@ -0,0 +1 @@ +Solution by Neil Bowers diff --git a/challenge-014/nick-logan/README b/challenge-014/nick-logan/README new file mode 100644 index 0000000000..86919ac8b8 --- /dev/null +++ b/challenge-014/nick-logan/README @@ -0,0 +1 @@ +Solution by Nick Logan diff --git a/challenge-014/ohmycloud/README b/challenge-014/ohmycloud/README new file mode 100644 index 0000000000..e993fafea7 --- /dev/null +++ b/challenge-014/ohmycloud/README @@ -0,0 +1 @@ +Solution by Ohmycloud diff --git a/challenge-014/oleksii-tsvietnov/README b/challenge-014/oleksii-tsvietnov/README new file mode 100644 index 0000000000..113183cc6d --- /dev/null +++ b/challenge-014/oleksii-tsvietnov/README @@ -0,0 +1 @@ +Solution by Oleksii Tsvietnov diff --git a/challenge-014/ozzy/README b/challenge-014/ozzy/README new file mode 100644 index 0000000000..44e39371ef --- /dev/null +++ b/challenge-014/ozzy/README @@ -0,0 +1 @@ +Solution by Ozzy diff --git a/challenge-014/pavel-jurca/README b/challenge-014/pavel-jurca/README new file mode 100644 index 0000000000..78d131bd34 --- /dev/null +++ b/challenge-014/pavel-jurca/README @@ -0,0 +1 @@ +Solution by Pavel Jurca diff --git a/challenge-014/pavel-starikov/README b/challenge-014/pavel-starikov/README new file mode 100644 index 0000000000..67ed468ff0 --- /dev/null +++ b/challenge-014/pavel-starikov/README @@ -0,0 +1 @@ +Solutions by Pavel Starikov. diff --git a/challenge-014/pete-houston/README b/challenge-014/pete-houston/README new file mode 100644 index 0000000000..15d44fe3a4 --- /dev/null +++ b/challenge-014/pete-houston/README @@ -0,0 +1 @@ +Solution by Pete Houston diff --git a/challenge-014/pete-sergeant/README b/challenge-014/pete-sergeant/README new file mode 100644 index 0000000000..baf8dfe304 --- /dev/null +++ b/challenge-014/pete-sergeant/README @@ -0,0 +1 @@ +Solutions by Pete Sergeant. diff --git a/challenge-014/philippe-bruhat/README b/challenge-014/philippe-bruhat/README new file mode 100644 index 0000000000..0bf3aeed05 --- /dev/null +++ b/challenge-014/philippe-bruhat/README @@ -0,0 +1 @@ +Solution by Philippe Bruhat diff --git a/challenge-014/prajith-p/README b/challenge-014/prajith-p/README new file mode 100644 index 0000000000..20517308f8 --- /dev/null +++ b/challenge-014/prajith-p/README @@ -0,0 +1 @@ +Solution by Prajith P diff --git a/challenge-014/rob4t/README b/challenge-014/rob4t/README new file mode 100644 index 0000000000..787d89fa0a --- /dev/null +++ b/challenge-014/rob4t/README @@ -0,0 +1 @@ +Solution by Robert Gratza diff --git a/challenge-014/ruben-westerberg/README b/challenge-014/ruben-westerberg/README new file mode 100644 index 0000000000..1a3a15799b --- /dev/null +++ b/challenge-014/ruben-westerberg/README @@ -0,0 +1,7 @@ +Solution by Ruben Westerberg + +ch-1.pl and ch-1.p6 + Run each program with a single argument 4 digit year to print dates of last Friday of the month + +ch-2.pl and ch-2.p6 + Run each program with the a single parameter argument which is the sequence size to print. If no argument is provided a default value of 10 is used. diff --git a/challenge-014/sean-meininger/README b/challenge-014/sean-meininger/README new file mode 100644 index 0000000000..8ca81e00a0 --- /dev/null +++ b/challenge-014/sean-meininger/README @@ -0,0 +1 @@ +Solution by Sean Meininger diff --git a/challenge-014/sergiotarxz/README b/challenge-014/sergiotarxz/README new file mode 100644 index 0000000000..6aac3baa4f --- /dev/null +++ b/challenge-014/sergiotarxz/README @@ -0,0 +1 @@ +Solution by Sergio Iglesias. diff --git a/challenge-014/shardiwal/README b/challenge-014/shardiwal/README new file mode 100644 index 0000000000..c529c63c01 --- /dev/null +++ b/challenge-014/shardiwal/README @@ -0,0 +1 @@ +Solution by Rakesh Kumar Shardiwal diff --git a/challenge-014/simon-proctor/README b/challenge-014/simon-proctor/README new file mode 100644 index 0000000000..f674742166 --- /dev/null +++ b/challenge-014/simon-proctor/README @@ -0,0 +1 @@ +Solution by Simon Proctor diff --git a/challenge-014/simon-reinhardt/README b/challenge-014/simon-reinhardt/README new file mode 100644 index 0000000000..422afa13b4 --- /dev/null +++ b/challenge-014/simon-reinhardt/README @@ -0,0 +1 @@ +Solution by Simon Reinhardt diff --git a/challenge-014/steve-rogerson/README b/challenge-014/steve-rogerson/README new file mode 100644 index 0000000000..bd91edaf63 --- /dev/null +++ b/challenge-014/steve-rogerson/README @@ -0,0 +1 @@ +Solution by Steve Rogerson diff --git a/challenge-014/steven-lembark/README b/challenge-014/steven-lembark/README new file mode 100644 index 0000000000..74894afa94 --- /dev/null +++ b/challenge-014/steven-lembark/README @@ -0,0 +1 @@ +Solution by Steven Lembark diff --git a/challenge-014/steven-wilson/README b/challenge-014/steven-wilson/README new file mode 100644 index 0000000000..6911e56168 --- /dev/null +++ b/challenge-014/steven-wilson/README @@ -0,0 +1 @@ +Solution by Steven Wilson diff --git a/challenge-014/tiago-stock/README b/challenge-014/tiago-stock/README new file mode 100644 index 0000000000..096a081b30 --- /dev/null +++ b/challenge-014/tiago-stock/README @@ -0,0 +1 @@ +Solution by Tiago Stock diff --git a/challenge-014/tim-smith/README b/challenge-014/tim-smith/README new file mode 100644 index 0000000000..83596de4fd --- /dev/null +++ b/challenge-014/tim-smith/README @@ -0,0 +1 @@ +Solution by Tim Smith diff --git a/challenge-014/tore-andersson/README b/challenge-014/tore-andersson/README new file mode 100644 index 0000000000..6b1b021ce0 --- /dev/null +++ b/challenge-014/tore-andersson/README @@ -0,0 +1 @@ +Solution by Tore Andersson diff --git a/challenge-014/uzluisf/README b/challenge-014/uzluisf/README new file mode 100644 index 0000000000..c668a77e15 --- /dev/null +++ b/challenge-014/uzluisf/README @@ -0,0 +1 @@ +Solution by Luis F. Uceta. diff --git a/challenge-014/veesh-goldman/README b/challenge-014/veesh-goldman/README new file mode 100644 index 0000000000..28a85f6e5c --- /dev/null +++ b/challenge-014/veesh-goldman/README @@ -0,0 +1 @@ +Solution by Veesh Goldman diff --git a/challenge-014/william-gilmore/README b/challenge-014/william-gilmore/README new file mode 100644 index 0000000000..e3df40ca2a --- /dev/null +++ b/challenge-014/william-gilmore/README @@ -0,0 +1 @@ +Solution by William Gilmore diff --git a/challenge-014/yary-h/README b/challenge-014/yary-h/README new file mode 100644 index 0000000000..200fbce413 --- /dev/null +++ b/challenge-014/yary-h/README @@ -0,0 +1 @@ +Solution by Yary H diff --git a/challenge-014/yozen-hernandez/README b/challenge-014/yozen-hernandez/README new file mode 100644 index 0000000000..07779f04ee --- /dev/null +++ b/challenge-014/yozen-hernandez/README @@ -0,0 +1 @@ +Solutions by Yozen Hernandez. -- cgit From 10ddb787b5a4f3d4a9e60b89cc23b06d43048a60 Mon Sep 17 00:00:00 2001 From: Dave Jacoby Date: Sun, 23 Jun 2019 23:54:36 -0400 Subject: p14c2 --- challenge-014/dave-jacoby/p14c2.pl | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 challenge-014/dave-jacoby/p14c2.pl (limited to 'challenge-014') diff --git a/challenge-014/dave-jacoby/p14c2.pl b/challenge-014/dave-jacoby/p14c2.pl new file mode 100644 index 0000000000..a36c3983e4 --- /dev/null +++ b/challenge-014/dave-jacoby/p14c2.pl @@ -0,0 +1,59 @@ +#!/usr/bin/env perl + +use feature qw{ say }; +use strict; +use warnings; + +# Using only the official postal (2-letter) abbreviations for the +# 50 U.S. states, write a script to find the longest English word +# you can spell? Here is the list of U.S. states abbreviations as +# per wikipedia page. This challenge was proposed by team member +# Neil Bowers. + +# using the %states hash makes for easy testing +my %states = map { $_ => 1 } qw{ + AL AK AZ AR CA CO CT DE FL GA + HI ID IL IN IA KS KY LA ME MD + MA MI MN MS MO MT NE NV NH NJ + NM NY NC ND OH OK OR PA RI SC + CD TN TX UT VT VA WA WV WI WY +}; + +# more universally available than my go-to dictionary DB +my @words; +if ( open my $fh, '<', '/usr/share/dict/words' ) { + @words = map { chomp; uc $_ } <$fh>; +} + +my $longest = ''; +FOR: for my $word (@words) { + my @word = $word =~ /(\w{2})/g; + + # there are apostrophes and unicode in that list + # this ensures that what we're looking at is valid. + my $join = join '', @word; + next unless $join eq $word; + + # we check every letter pair and determine if it's in + # the states hash. we have labelled the outside for loop + # as FOR, so we can `next` on the outer loop, not just the + # inner loop. + for my $wo ( @word ) { + my $n = $states{$wo} ? 1 : 0; + next FOR unless $n; + } + + # words that are not entirely made out of state abbreviations + # will not reach this point. And this will ignore words of + # identical size to the found longest, but I know they don't + # exist. + $longest = $word if length $longest < length $word; +} +say $longest; + +__DATA__ + +CACOGALACTIA + + noun In pathology, a bad condition of the milk. + -- cgit From a5665f2577c2877e3708316c0256150c03e18948 Mon Sep 17 00:00:00 2001 From: Dave Jacoby Date: Mon, 24 Jun 2019 00:19:36 -0400 Subject: c1 --- challenge-014/dave-jacoby/p14c1.pl | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 challenge-014/dave-jacoby/p14c1.pl (limited to 'challenge-014') diff --git a/challenge-014/dave-jacoby/p14c1.pl b/challenge-014/dave-jacoby/p14c1.pl new file mode 100644 index 0000000000..b20de9f4c1 --- /dev/null +++ b/challenge-014/dave-jacoby/p14c1.pl @@ -0,0 +1,66 @@ +#!/usr/bin/env perl + +use strict ; +use warnings ; +use feature qw{ postderef say signatures state } ; +no warnings qw{ experimental::postderef experimental::signatures } ; + +use Carp; + +# Write a script to generate Van Eck’s sequence starts with 0. +# For more information, please check out wikipedia page. +# This challenge was proposed by team member Andrezgz. + + +# 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5 ... [1] + +# let a[0] = 0 +my @a ; +push @a , 0; + +for my $n ( 0 .. 30 ) { + + # otherwise a[n+1]=0 + $a[$n+1] = 0; + + # for n >= 0, if there exists an m < n such that a[m] == a[n], + # take the largest such m and set a[n+1] = n-m, + for my $m ( 0 .. $n -1 ) { + $a[$n+1] = $n - $m if $a[$n]==$a[$m]; + } + say qq{n = $n \t a[n] = $a[$n]}; +} + +__DATA__ + +n = 0 a[n] = 0 +n = 1 a[n] = 0 +n = 2 a[n] = 1 +n = 3 a[n] = 0 +n = 4 a[n] = 2 +n = 5 a[n] = 0 +n = 6 a[n] = 2 +n = 7 a[n] = 2 +n = 8 a[n] = 1 +n = 9 a[n] = 6 +n = 10 a[n] = 0 +n = 11 a[n] = 5 +n = 12 a[n] = 0 +n = 13 a[n] = 2 +n = 14 a[n] = 6 +n = 15 a[n] = 5 +n = 16 a[n] = 4 +n = 17 a[n] = 0 +n = 18 a[n] = 5 +n = 19 a[n] = 3 +n = 20 a[n] = 0 +n = 21 a[n] = 3 +n = 22 a[n] = 2 +n = 23 a[n] = 9 +n = 24 a[n] = 0 +n = 25 a[n] = 4 +n = 26 a[n] = 9 +n = 27 a[n] = 3 +n = 28 a[n] = 6 +n = 29 a[n] = 14 +n = 30 a[n] = 0 -- cgit From 3fd3726d89f395dd3817a0c762ac324db1027e15 Mon Sep 17 00:00:00 2001 From: Aaron Sherman Date: Mon, 24 Jun 2019 00:31:44 -0400 Subject: ajs First pass solutions for two problems --- challenge-014/aaron-sherman/META6.json | 21 + challenge-014/aaron-sherman/README | 16 - challenge-014/aaron-sherman/README.md | 8 + challenge-014/aaron-sherman/eck.p6 | 17 + challenge-014/aaron-sherman/us-words.p6 | 42 ++ challenge-014/aaron-sherman/words | 1000 +++++++++++++++++++++++++++++++ 6 files changed, 1088 insertions(+), 16 deletions(-) create mode 100644 challenge-014/aaron-sherman/META6.json delete mode 100644 challenge-014/aaron-sherman/README create mode 100644 challenge-014/aaron-sherman/README.md create mode 100644 challenge-014/aaron-sherman/eck.p6 create mode 100644 challenge-014/aaron-sherman/us-words.p6 create mode 100644 challenge-014/aaron-sherman/words (limited to 'challenge-014') diff --git a/challenge-014/aaron-sherman/META6.json b/challenge-014/aaron-sherman/META6.json new file mode 100644 index 0000000000..18aa0e5da3 --- /dev/null +++ b/challenge-014/aaron-sherman/META6.json @@ -0,0 +1,21 @@ +{ + "perl" : "6.c", + "name" : "Challenge014::AJS", + "api" : "1", + "auth" : "github:ajs", + "version" : "0.0.1", + "description" : "Solutions to this week's puzzles.", + "authors" : [ "Aaron Sherman" ], + "license" : "Artistic-2.0", + "provides" : { }, + "depends" : [ + "JSON::Tiny", + "WWW", + "Math::Sequences::Numberphile" + ], + "build-depends" : [ ], + "test-depends" : [ ], + "resources" : [ ], + "tags": [ ], + "source-url" : "git@github.com:manwar/perlweeklychallenge-club.git" +} diff --git a/challenge-014/aaron-sherman/README b/challenge-014/aaron-sherman/README deleted file mode 100644 index 08d5ec39d2..0000000000 --- a/challenge-014/aaron-sherman/README +++ /dev/null @@ -1,16 +0,0 @@ -Solutions by Aaron Sherman. - -Challenge #1: The first Euclid non-prime - -This puzzle afforded me the opportunity to advertize a bit for the -Math::Sequences module by showing how a new entry would be defined. - -It otherwise simply prints the solution number uninterestingly. - -Challenge #2: Common path prefixes - -I thought that this would be a good chance to show off Perl 6's -user-defined operator features including the use of a user-defined -operator in a reduction meta-operator. - -The use of the program is simple and can be shown using --help diff --git a/challenge-014/aaron-sherman/README.md b/challenge-014/aaron-sherman/README.md new file mode 100644 index 0000000000..d042f35b39 --- /dev/null +++ b/challenge-014/aaron-sherman/README.md @@ -0,0 +1,8 @@ +# Solutions by Aaron Sherman. + +## Challenge #1: Van Eck’s sequence + +This week's first puzzle happens to be one that I just finished +adding to [`Math::Sequences::Integer`](https://github.com/ajs/perl6-Math-Sequences) +so my solution is an underwhelming reference to and plug for that +module. [Here is the specific definition](https://github.com/ajs/perl6-Math-Sequences/blob/cb8d9f58092718f85debf68d2f183288741bdfad/lib/Math/Sequences/Numberphile.pm#L196). diff --git a/challenge-014/aaron-sherman/eck.p6 b/challenge-014/aaron-sherman/eck.p6 new file mode 100644 index 0000000000..f5c914c060 --- /dev/null +++ b/challenge-014/aaron-sherman/eck.p6 @@ -0,0 +1,17 @@ +#!/usr/bin/env perl6 + +# Challenge #014.2 +# +# Write a script to generate Van Eck’s sequence starts with 0. For more +# information, please check out wikipedia page. This challenge was +# proposed by team member Andrezgz. + +# This solution is somewhat cheeting, but since I just wrote this module +# a few days ago (not knowing about the upcoming challenge) I won't feel +# bad about it. ;-) + +use v6.c; + +use Math::Sequences::Numberphile; + +.say for @A181391; diff --git a/challenge-014/aaron-sherman/us-words.p6 b/challenge-014/aaron-sherman/us-words.p6 new file mode 100644 index 0000000000..38456b212d --- /dev/null +++ b/challenge-014/aaron-sherman/us-words.p6 @@ -0,0 +1,42 @@ +#!/usr/bin/env perl6 + +# Challenge #2 +# Using only the official postal (2-letter) abbreviations for the 50 U.S. +# states, write a script to find the longest English word you can spell? +# Here is the list of U.S. states abbreviations as per wikipedia page. +# This challenge was proposed by team member Neil Bowers. + +use v6.c; + +use WWW; + +our $online-wordlist = 'https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt'; +our $local-wordlist = '/usr/share/dict/words'; + +sub get-words() { + sub get-local-words($path) { + $path.IO.e ?? $path.IO.lines>>.trim !! Nil + } + get-local-words($local-wordlist) // get-local-words('words') // + get($online-wordlist).words; +} +sub get-states(:$territories) { + my $states = < + AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS + MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV + WI WY>; + my $others = ; + |$states, |($territories ?? $others !! ()); +} + +proto MAIN(|) {*} +multi MAIN(Bool :$test!) { + use Test; + my @states = get-states; + cmp-ok 'code', '~~', /:i^@states$/, "Pattern match a word"; +} +multi MAIN(Bool :$territories) { + my @wordlist = get-words.grep({.defined}); + my @states = get-states(:$territories); + say @wordlist.grep(/:i^@states+$/).max(*.chars); +} \ No newline at end of file diff --git a/challenge-014/aaron-sherman/words b/challenge-014/aaron-sherman/words new file mode 100644 index 0000000000..660e5f2c20 --- /dev/null +++ b/challenge-014/aaron-sherman/words @@ -0,0 +1,1000 @@ +a +ability +able +about +above +accept +according +account +across +act +action +activity +actually +add +address +administration +admit +adult +affect +after +again +against +age +agency +agent +ago +agree +agreement +ahead +air +all +allow +almost +alone +along +already +also +although +always +American +among +amount +analysis +and +animal +another +answer +any +anyone +anything +appear +apply +approach +area +argue +arm +around +arrive +art +article +artist +as +ask +assume +at +attack +attention +attorney +audience +author +authority +available +avoid +away +baby +back +bad +bag +ball +bank +bar +base +be +beat +beautiful +because +become +bed +before +begin +behavior +behind +believe +benefit +best +better +between +beyond +big +bill +billion +bit +black +blood +blue +board +body +book +born +both +box +boy +break +bring +brother +budget +build +building +business +but +buy +by +call +camera +campaign +can +cancer +candidate +capital +car +card +care +career +carry +case +catch +cause +cell +center +central +century +certain +certainly +chair +challenge +chance +change +character +charge +check +child +choice +choose +church +citizen +city +civil +claim +class +clear +clearly +close +coach +cold +collection +college +color +come +commercial +common +community +company +compare +computer +concern +condition +conference +Congress +consider +consumer +contain +continue +control +cost +could +country +couple +course +court +cover +create +crime +cultural +culture +cup +current +customer +cut +dark +data +daughter +day +dead +deal +death +debate +decade +decide +decision +deep +defense +degree +Democrat +democratic +describe +design +despite +detail +determine +develop +development +die +difference +different +difficult +dinner +direction +director +discover +discuss +discussion +disease +do +doctor +dog +door +down +draw +dream +drive +drop +drug +during +each +early +east +easy +eat +economic +economy +edge +education +effect +effort +eight +either +election +else +employee +end +energy +enjoy +enough +enter +entire +environment +environmental +especially +establish +even +evening +event +ever +every +everybody +everyone +everything +evidence +exactly +example +executive +exist +expect +experience +expert +explain +eye +face +fact +factor +fail +fall +family +far +fast +father +fear +federal +feel +feeling +few +field +fight +figure +fill +film +final +finally +financial +find +fine +finger +finish +fire +firm +first +fish +five +floor +fly +focus +follow +food +foot +for +force +foreign +forget +form +former +forward +four +free +friend +from +front +full +fund +future +game +garden +gas +general +generation +get +girl +give +glass +go +goal +good +government +great +green +ground +group +grow +growth +guess +gun +guy +hair +half +hand +hang +happen +happy +hard +have +he +head +health +hear +heart +heat +heavy +help +her +here +herself +high +him +himself +his +history +hit +hold +home +hope +hospital +hot +hotel +hour +house +how +however +huge +human +hundred +husband +I +idea +identify +if +image +imagine +impact +important +improve +in +include +including +increase +indeed +indicate +individual +industry +information +inside +instead +institution +interest +interesting +international +interview +into +investment +involve +issue +it +item +its +itself +job +join +just +keep +key +kid +kill +kind +kitchen +know +knowledge +land +language +large +last +late +later +laugh +law +lawyer +lay +lead +leader +learn +least +leave +left +leg +legal +less +let +letter +level +lie +life +light +like +likely +line +list +listen +little +live +local +long +look +lose +loss +lot +love +low +machine +magazine +main +maintain +major +majority +make +man +manage +management +manager +many +market +marriage +material +matter +may +maybe +me +mean +measure +media +medical +meet +meeting +member +memory +mention +message +method +middle +might +military +million +mind +minute +miss +mission +model +modern +moment +money +month +more +morning +most +mother +mouth +move +movement +movie +Mr +Mrs +much +music +must +my +myself +name +nation +national +natural +nature +near +nearly +necessary +need +network +never +new +news +newspaper +next +nice +night +no +none +nor +north +not +note +nothing +notice +now +n't +number +occur +of +off +offer +office +officer +official +often +oh +oil +ok +old +on +once +one +only +onto +open +operation +opportunity +option +or +order +organization +other +others +our +out +outside +over +own +owner +page +pain +painting +paper +parent +part +participant +particular +particularly +partner +party +pass +past +patient +pattern +pay +peace +people +per +perform +performance +perhaps +period +person +personal +phone +physical +pick +picture +piece +place +plan +plant +play +player +PM +point +police +policy +political +politics +poor +popular +population +position +positive +possible +power +practice +prepare +present +president +pressure +pretty +prevent +price +private +probably +problem +process +produce +product +production +professional +professor +program +project +property +protect +prove +provide +public +pull +purpose +push +put +quality +question +quickly +quite +race +radio +raise +range +rate +rather +reach +read +ready +real +reality +realize +really +reason +receive +recent +recently +recognize +record +red +reduce +reflect +region +relate +relationship +religious +remain +remember +remove +report +represent +Republican +require +research +resource +respond +response +responsibility +rest +result +return +reveal +rich +right +rise +risk +road +rock +role +room +rule +run +safe +same +save +say +scene +school +science +scientist +score +sea +season +seat +second +section +security +see +seek +seem +sell +send +senior +sense +series +serious +serve +service +set +seven +several +sex +sexual +shake +share +she +shoot +short +shot +should +shoulder +show +side +sign +significant +similar +simple +simply +since +sing +single +sister +sit +site +situation +six +size +skill +skin +small +smile +so +social +society +soldier +some +somebody +someone +something +sometimes +son +song +soon +sort +sound +source +south +southern +space +speak +special +specific +speech +spend +sport +spring +staff +stage +stand +standard +star +start +state +statement +station +stay +step +still +stock +stop +store +story +strategy +street +strong +structure +student +study +stuff +style +subject +success +successful +such +suddenly +suffer +suggest +summer +support +sure +surface +system +table +take +talk +task +tax +teach +teacher +team +technology +television +tell +ten +tend +term +test +than +thank +that +the +their +them +themselves +then +theory +there +these +they +thing +think +third +this +those +though +thought +thousand +threat +three +through +throughout +throw +thus +time +to +today +together +tonight +too +top +total +tough +toward +town +trade +traditional +training +travel +treat +treatment +tree +trial +trip +trouble +true +truth +try +turn +TV +two +type +under +understand +unit +until +up +upon +us +use +usually +value +various +very +victim +view +violence +visit +voice +vote +wait +walk +wall +want +war +watch +water +way +we +weapon +wear +week +weight +well +west +western +what +whatever +when +where +whether +which +while +white +who +whole +whom +whose +why +wide +wife +will +win +wind +window +wish +with +within +without +woman +wonder +word +work +worker +world +worry +would +write +writer +wrong +yard +yeah +year +yes +yet +you +young +your +yourself -- cgit From c405cef34bfe76ceb30d3bcddf875970aec1e51b Mon Sep 17 00:00:00 2001 From: Rob Van Dam Date: Sun, 23 Jun 2019 23:58:00 -0600 Subject: Initial commit of new README --- challenge-014/rob-van-dam/README | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-014/rob-van-dam/README (limited to 'challenge-014') diff --git a/challenge-014/rob-van-dam/README b/challenge-014/rob-van-dam/README new file mode 100644 index 0000000000..d0e17767f8 --- /dev/null +++ b/challenge-014/rob-van-dam/README @@ -0,0 +1 @@ +Solution by Rob Van Dam -- cgit From b667026725ada5be8421b2f74f3846ed77debd62 Mon Sep 17 00:00:00 2001 From: Rob Van Dam Date: Sun, 23 Jun 2019 23:58:24 -0600 Subject: Solution to Challenge #1, Week 014 --- challenge-014/rob-van-dam/perl5/ch-1.pl | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 challenge-014/rob-van-dam/perl5/ch-1.pl (limited to 'challenge-014') diff --git a/challenge-014/rob-van-dam/perl5/ch-1.pl b/challenge-014/rob-van-dam/perl5/ch-1.pl new file mode 100644 index 0000000000..613c1250a3 --- /dev/null +++ b/challenge-014/rob-van-dam/perl5/ch-1.pl @@ -0,0 +1,40 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use v5.10; + +my $M = shift @ARGV || 10; + +#slow(); +fast(); + +# this works but is very slow for large $M +# as its roughly O(n**2) +sub slow { + my @a = (0); + for my $n (0..$M) { + my $r = 0; + foreach my $m (0..($n-1)) { + last if ! defined $a[$n]; + $r = $n - $m if $a[$m] == $a[$n]; + } + $a[$n + 1] = $r; + say $a[$n]; + } +} + +# this is much faster for large $M +# by caching the last time we say a given number +# so its roughly O(n**2) but requires roughly O(2n) space +sub fast { + my @a = (0); + my @last = (); + for my $n (0..$M) { + my $m = $last[ $a[$n] ]; + my $r = defined $m ? $n - $m : 0; + $last[$a[$n]] = $n; + $a[$n + 1] = $r; + say $a[$n]; + } +} -- cgit From 50cc249a52dab9ec3113fa3396b2382153deed02 Mon Sep 17 00:00:00 2001 From: Rob Van Dam Date: Mon, 24 Jun 2019 00:43:20 -0600 Subject: Added solution for Challenge #2, Week 014 --- challenge-014/rob-van-dam/perl5/ch-2.pl | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 challenge-014/rob-van-dam/perl5/ch-2.pl (limited to 'challenge-014') diff --git a/challenge-014/rob-van-dam/perl5/ch-2.pl b/challenge-014/rob-van-dam/perl5/ch-2.pl new file mode 100644 index 0000000000..95d0f2c6af --- /dev/null +++ b/challenge-014/rob-van-dam/perl5/ch-2.pl @@ -0,0 +1,42 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use v5.10; + +use Data::Dumper; + +# all state short codes +my %states = map { $_ => 1 } qw(AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY); + +# unique letters contained in these codes (any word matching any letter not in this list is right out) +my %uniq = map { $_ => 1 } map { split // } keys %states; +my $uniq = join '', sort { $a cmp $b } keys %uniq; +my $notok = qr/[^$uniq]/; # by my calculations, should be missing B and Q + +my $file = '/usr/share/dict/american-english-insane'; +$file = '/usr/share/dict/american-english-huge' if ! -e $file; +$file = '/usr/share/dict/words' if ! -e $file; + +open my $words, '<', $file or die $!; +my $longest = ''; +WORD: foreach my $word (<$words>) { + chomp $word; + $word = uc $word; + next if $word =~ $notok; # skip words that contain an invalid character (especially B or Q but also punctuation and accents) + next if length($word) % 2 == 1; # skip odd length words, they can't consist of pairs + next if length($word) <= length($longest); # skip words that aren't longer than the current longest + my @pairs = $word =~ m/../g; + foreach my $pair (@pairs) { + next WORD if ! $states{$pair}; # skip words that have a pair that doesn't match a state + } + $longest = $word; + #say $word; +} +say $longest; + +# CONCORDE +# OR +# CACOGALACTIA +# +# depending on the dictionary available -- cgit From 77804452f1fc07db3b1c500d31e5ed89cdaf5241 Mon Sep 17 00:00:00 2001 From: Rob Van Dam Date: Mon, 24 Jun 2019 01:17:38 -0600 Subject: Solution to Challenge #3, Week 014 --- challenge-014/rob-van-dam/perl5/ch-3.pl | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 challenge-014/rob-van-dam/perl5/ch-3.pl (limited to 'challenge-014') diff --git a/challenge-014/rob-van-dam/perl5/ch-3.pl b/challenge-014/rob-van-dam/perl5/ch-3.pl new file mode 100644 index 0000000000..c4aa2e40a3 --- /dev/null +++ b/challenge-014/rob-van-dam/perl5/ch-3.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use v5.10; + +use HTTP::Tiny; +use URI::Escape; +use JSON::PP qw(decode_json); +use Data::Dumper; + +my $base = 'http://geodb-free-service.wirefreethought.com'; +my $find = '/v1/geo/cities?limit=10&offset=0&namePrefix=%s'; +my $time = '/v1/geo/cities/%d/time'; + +my $search = shift @ARGV || 'New Orleans'; +my @cities = find_cities($search); + +binmode STDOUT, ":utf8"; # avoid wide character warnings on certain results +foreach my $city (@cities) { + say $city->{'name'}, ', ', $city->{'regionCode'}, ', ', $city->{'countryCode'}, ': ', get_time($city->{'id'}); +} + +sub find_cities { + my $search = shift; + + my $url = sprintf $base . $find, uri_escape($search); + return @{ _get($url) }; +} + +sub get_time { + my $city_id = shift; + + my $url = sprintf $base . $time, $city_id; + return _get($url); +} + +sub _get { + my $url = shift; + + my $response = HTTP::Tiny->new->get($url); + my $parsed = decode_json($response->{'content'}); + return $parsed->{'data'}; +} -- cgit From 3476c94f8c9f8a3bd4175122859850ce2640555a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 24 Jun 2019 11:10:57 +0100 Subject: - Added solutions by Dave Jacoby. --- challenge-014/dave-jacoby/p14c1.pl | 66 --------------------------------- challenge-014/dave-jacoby/p14c2.pl | 59 ----------------------------- challenge-014/dave-jacoby/perl5/ch-1.pl | 66 +++++++++++++++++++++++++++++++++ challenge-014/dave-jacoby/perl5/ch-2.pl | 59 +++++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 125 deletions(-) delete mode 100644 challenge-014/dave-jacoby/p14c1.pl delete mode 100644 challenge-014/dave-jacoby/p14c2.pl create mode 100644 challenge-014/dave-jacoby/perl5/ch-1.pl create mode 100644 challenge-014/dave-jacoby/perl5/ch-2.pl (limited to 'challenge-014') diff --git a/challenge-014/dave-jacoby/p14c1.pl b/challenge-014/dave-jacoby/p14c1.pl deleted file mode 100644 index b20de9f4c1..0000000000 --- a/challenge-014/dave-jacoby/p14c1.pl +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env perl - -use strict ; -use warnings ; -use feature qw{ postderef say signatures state } ; -no warnings qw{ experimental::postderef experimental::signatures } ; - -use Carp; - -# Write a script to generate Van Eck’s sequence starts with 0. -# For more information, please check out wikipedia page. -# This challenge was proposed by team member Andrezgz. - - -# 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5 ... [1] - -# let a[0] = 0 -my @a ; -push @a , 0; - -for my $n ( 0 .. 30 ) { - - # otherwise a[n+1]=0 - $a[$n+1] = 0; - - # for n >= 0, if there exists an m < n such that a[m] == a[n], - # take the largest such m and set a[n+1] = n-m, - for my $m ( 0 .. $n -1 ) { - $a[$n+1] = $n - $m if $a[$n]==$a[$m]; - } - say qq{n = $n \t a[n] = $a[$n]}; -} - -__DATA__ - -n = 0 a[n] = 0 -n = 1 a[n] = 0 -n = 2 a[n] = 1 -n = 3 a[n] = 0 -n = 4 a[n] = 2 -n = 5 a[n] = 0 -n = 6 a[n] = 2 -n = 7 a[n] = 2 -n = 8 a[n] = 1 -n = 9 a[n] = 6 -n = 10 a[n] = 0 -n = 11 a[n] = 5 -n = 12 a[n] = 0 -n = 13 a[n] = 2 -n = 14 a[n] = 6 -n = 15 a[n] = 5 -n = 16 a[n] = 4 -n = 17 a[n] = 0 -n = 18 a[n] = 5 -n = 19 a[n] = 3 -n = 20 a[n] = 0 -n = 21 a[n] = 3 -n = 22 a[n] = 2 -n = 23 a[n] = 9 -n = 24 a[n] = 0 -n = 25 a[n] = 4 -n = 26 a[n] = 9 -n = 27 a[n] = 3 -n = 28 a[n] = 6 -n = 29 a[n] = 14 -n = 30 a[n] = 0 diff --git a/challenge-014/dave-jacoby/p14c2.pl b/challenge-014/dave-jacoby/p14c2.pl deleted file mode 100644 index a36c3983e4..0000000000 --- a/challenge-014/dave-jacoby/p14c2.pl +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env perl - -use feature qw{ say }; -use strict; -use warnings; - -# Using only the official postal (2-letter) abbreviations for the -# 50 U.S. states, write a script to find the longest English word -# you can spell? Here is the list of U.S. states abbreviations as -# per wikipedia page. This challenge was proposed by team member -# Neil Bowers. - -# using the %states hash makes for easy testing -my %states = map { $_ => 1 } qw{ - AL AK AZ AR CA CO CT DE FL GA - HI ID IL IN IA KS KY LA ME MD - MA MI MN MS MO MT NE NV NH NJ - NM NY NC ND OH OK OR PA RI SC - CD TN TX UT VT VA WA WV WI WY -}; - -# more universally available than my go-to dictionary DB -my @words; -if ( open my $fh, '<', '/usr/share/dict/words' ) { - @words = map { chomp; uc $_ } <$fh>; -} - -my $longest = ''; -FOR: for my $word (@words) { - my @word = $word =~ /(\w{2})/g; - - # there are apostrophes and unicode in that list - # this ensures that what we're looking at is valid. - my $join = join '', @word; - next unless $join eq $word; - - # we check every letter pair and determine if it's in - # the states hash. we have labelled the outside for loop - # as FOR, so we can `next` on the outer loop, not just the - # inner loop. - for my $wo ( @word ) { - my $n = $states{$wo} ? 1 : 0; - next FOR unless $n; - } - - # words that are not entirely made out of state abbreviations - # will not reach this point. And this will ignore words of - # identical size to the found longest, but I know they don't - # exist. - $longest = $word if length $longest < length $word; -} -say $longest; - -__DATA__ - -CACOGALACTIA - - noun In pathology, a bad condition of the milk. - diff --git a/challenge-014/dave-jacoby/perl5/ch-1.pl b/challenge-014/dave-jacoby/perl5/ch-1.pl new file mode 100644 index 0000000000..b20de9f4c1 --- /dev/null +++ b/challenge-014/dave-jacoby/perl5/ch-1.pl @@ -0,0 +1,66 @@ +#!/usr/bin/env perl + +use strict ; +use warnings ; +use feature qw{ postderef say signatures state } ; +no warnings qw{ experimental::postderef experimental::signatures } ; + +use Carp; + +# Write a script to generate Van Eck’s sequence starts with 0. +# For more information, please check out wikipedia page. +# This challenge was proposed by team member Andrezgz. + + +# 0, 0, 1, 0, 2, 0, 2, 2, 1, 6, 0, 5, 0, 2, 6, 5, 4, 0, 5 ... [1] + +# let a[0] = 0 +my @a ; +push @a , 0; + +for my $n ( 0 .. 30 ) { + + # otherwise a[n+1]=0 + $a[$n+1] = 0; + + # for n >= 0, if there exists an m < n such that a[m] == a[n], + # take the largest such m and set a[n+1] = n-m, + for my $m ( 0 .. $n -1 ) { + $a[$n+1] = $n - $m if $a[$n]==$a[$m]; + } + say qq{n = $n \t a[n] = $a[$n]}; +} + +__DATA__ + +n = 0 a[n] = 0 +n = 1 a[n] = 0 +n = 2 a[n] = 1 +n = 3 a[n] = 0 +n = 4 a[n] = 2 +n = 5 a[n] = 0 +n = 6 a[n] = 2 +n = 7 a[n] = 2 +n = 8 a[n] = 1 +n = 9 a[n] = 6 +n = 10 a[n] = 0 +n = 11 a[n] = 5 +n = 12 a[n] = 0 +n = 13 a[n] = 2 +n = 14 a[n] = 6 +n = 15 a[n] = 5 +n = 16 a[n] = 4 +n = 17 a[n] = 0 +n = 18 a[n] = 5 +n = 19 a[n] = 3 +n = 20 a[n] = 0 +n = 21 a[n] = 3 +n = 22 a[n] = 2 +n = 23 a[n] = 9 +n = 24 a[n] = 0 +n = 25 a[n] = 4 +n = 26 a[n] = 9 +n