diff options
Diffstat (limited to 'challenge-006')
81 files changed, 246 insertions, 0 deletions
diff --git a/challenge-006/abigail/README b/challenge-006/abigail/README new file mode 100644 index 0000000000..5f0d73ae16 --- /dev/null +++ b/challenge-006/abigail/README @@ -0,0 +1 @@ +Solution by Abigail diff --git a/challenge-006/adam-russell/README b/challenge-006/adam-russell/README new file mode 100644 index 0000000000..9420c9a781 --- /dev/null +++ b/challenge-006/adam-russell/README @@ -0,0 +1 @@ +Solution by Adam Russell diff --git a/challenge-006/ailbhe-tweedie/README b/challenge-006/ailbhe-tweedie/README new file mode 100644 index 0000000000..36d4034b70 --- /dev/null +++ b/challenge-006/ailbhe-tweedie/README @@ -0,0 +1 @@ +Solution by Ailbhe Tweedie diff --git a/challenge-006/alex-daniel/README b/challenge-006/alex-daniel/README new file mode 100644 index 0000000000..65550789bd --- /dev/null +++ b/challenge-006/alex-daniel/README @@ -0,0 +1 @@ +Solution by Alex Daniel. diff --git a/challenge-006/alexander-karelas/README b/challenge-006/alexander-karelas/README new file mode 100644 index 0000000000..3de9fce8d9 --- /dev/null +++ b/challenge-006/alexander-karelas/README @@ -0,0 +1 @@ +Solution by Alexander Karelas diff --git a/challenge-006/alexey-melezhik/README b/challenge-006/alexey-melezhik/README new file mode 100644 index 0000000000..ca7008f224 --- /dev/null +++ b/challenge-006/alexey-melezhik/README @@ -0,0 +1 @@ +Solution by Alexey Melezhik diff --git a/challenge-006/alicia-bielsa/README b/challenge-006/alicia-bielsa/README new file mode 100644 index 0000000000..c5187874c3 --- /dev/null +++ b/challenge-006/alicia-bielsa/README @@ -0,0 +1 @@ +Solution by Alicia Beilsa. diff --git a/challenge-006/andrezgz/README b/challenge-006/andrezgz/README new file mode 100644 index 0000000000..f4fd0da88e --- /dev/null +++ b/challenge-006/andrezgz/README @@ -0,0 +1 @@ +Solution by Andrezgz diff --git a/challenge-006/antonio-gamiz/README b/challenge-006/antonio-gamiz/README new file mode 100644 index 0000000000..1f5ed5871a --- /dev/null +++ b/challenge-006/antonio-gamiz/README @@ -0,0 +1 @@ +Solution by Antonio Gamiz diff --git a/challenge-006/arne-sommer/README b/challenge-006/arne-sommer/README new file mode 100644 index 0000000000..b5d88e4df4 --- /dev/null +++ b/challenge-006/arne-sommer/README @@ -0,0 +1 @@ +Solution by Arne Sommer. diff --git a/challenge-006/arpad-toth/README b/challenge-006/arpad-toth/README new file mode 100644 index 0000000000..6661dd82c1 --- /dev/null +++ b/challenge-006/arpad-toth/README @@ -0,0 +1 @@ +Solution by Arpad Toth diff --git a/challenge-006/athanasius/README b/challenge-006/athanasius/README new file mode 100644 index 0000000000..cc357fda4a --- /dev/null +++ b/challenge-006/athanasius/README @@ -0,0 +1 @@ +Solution by Athanasius diff --git a/challenge-006/aubrey-quarcoo/README b/challenge-006/aubrey-quarcoo/README new file mode 100644 index 0000000000..8e63a2c1f5 --- /dev/null +++ b/challenge-006/aubrey-quarcoo/README @@ -0,0 +1 @@ +Solution by Aubrey Quarcoo diff --git a/challenge-006/bill-palmer/README b/challenge-006/bill-palmer/README new file mode 100644 index 0000000000..08ec849a41 --- /dev/null +++ b/challenge-006/bill-palmer/README @@ -0,0 +1 @@ +Solution by Bill Palmer. diff --git a/challenge-006/bob-kleemann/README b/challenge-006/bob-kleemann/README new file mode 100644 index 0000000000..78680e4035 --- /dev/null +++ b/challenge-006/bob-kleemann/README @@ -0,0 +1 @@ +Solution by Bob Kleemann diff --git a/challenge-006/cliveholloway/README b/challenge-006/cliveholloway/README new file mode 100644 index 0000000000..b69201296e --- /dev/null +++ b/challenge-006/cliveholloway/README @@ -0,0 +1 @@ +Solution by Clive Holloway diff --git a/challenge-006/daniel-mantovani/README b/challenge-006/daniel-mantovani/README new file mode 100644 index 0000000000..ed538216f2 --- /dev/null +++ b/challenge-006/daniel-mantovani/README @@ -0,0 +1 @@ +Solution by Daniel Mantovani diff --git a/challenge-006/dave-cross/README b/challenge-006/dave-cross/README new file mode 100644 index 0000000000..04b1b0623b --- /dev/null +++ b/challenge-006/dave-cross/README @@ -0,0 +1 @@ +Solution by Dave Cross diff --git a/challenge-006/dave-jacoby/README b/challenge-006/dave-jacoby/README new file mode 100644 index 0000000000..7c06689f16 --- /dev/null +++ b/challenge-006/dave-jacoby/README @@ -0,0 +1 @@ +Solution by Dave Jacoby diff --git a/challenge-006/david-kayal/README b/challenge-006/david-kayal/README new file mode 100644 index 0000000000..66f8615260 --- /dev/null +++ b/challenge-006/david-kayal/README @@ -0,0 +1 @@ +Solution by David Kayal diff --git a/challenge-006/doug-schrag/README b/challenge-006/doug-schrag/README new file mode 100644 index 0000000000..bf8a10ffb4 --- /dev/null +++ b/challenge-006/doug-schrag/README @@ -0,0 +1 @@ +Solution by Doug Schrag diff --git a/challenge-006/duncan-c-white/README b/challenge-006/duncan-c-white/README new file mode 100644 index 0000000000..b785f171b8 --- /dev/null +++ b/challenge-006/duncan-c-white/README @@ -0,0 +1,35 @@ +Challenge 1: "Write a program which prints out all anagrams for a given word." + +Note: I assume that we'll need a wordlist to judge whether a rearrangement +of letters is actually a word, /usr/share/dict/words is the obvious one +to use. The simplest way of solving this problem is to use alphabetically +sorted SIGNATURES of words - simply the bag of letters in the word sorted. + +So "hello"'s signature is "ehllo". The important thing for anagram purposes +is that "ehllo" is the signature not only of "hello", but of any other anagram +of hello too. + +So: calculate the signature of the given word, then for every word in the +dictionary (of the right length if we want to save time), calculate that +dictionary word's signature - then print out the dictionary word if it's +signature is the sameas the given word's signature. + +Note that ch-1.pl takes two command line arguments: the first is the +word, the second is the optional filename of the wordlist to use, +if it's not given then /usr/share/dict/words is used by default. + + +Challenge 2: "Write a program to find the sequence of characters that has +the most anagrams." + +That's rather badly worded, but I choose to interprete it as "find which +word in a wordlist has most anagrams also in that wordlist". + +Note that ch-2.pl takes a single optional command line argument: +the filename of the wordlist to use, if it's not given then +/usr/share/dict/words is used by default. + +So: Calculate the signature of every word in the dictionary, building %anag: +a mapping from signature -> list of words with that signature, and keep track +of the longest word list of any signature (i.e. the biggest anagram set so far) +as we go. Print out the signature with the longest word list at the end. diff --git a/challenge-006/e-choroba/README b/challenge-006/e-choroba/README new file mode 100644 index 0000000000..efff637bcb --- /dev/null +++ b/challenge-006/e-choroba/README @@ -0,0 +1 @@ +Solutions by E. Choroba. diff --git a/challenge-006/eddy-hs/README b/challenge-006/eddy-hs/README new file mode 100644 index 0000000000..0ed51d222d --- /dev/null +++ b/challenge-006/eddy-hs/README @@ -0,0 +1 @@ +Solution by Eddy HS diff --git a/challenge-006/finley/README b/challenge-006/finley/README new file mode 100644 index 0000000000..f08a121076 --- /dev/null +++ b/challenge-006/finley/README @@ -0,0 +1 @@ +Solution by Finley diff --git a/challenge-006/fjwhittle/README b/challenge-006/fjwhittle/README new file mode 100644 index 0000000000..7dcc95e189 --- /dev/null +++ b/challenge-006/fjwhittle/README @@ -0,0 +1 @@ +Solution by Francis Whittle diff --git a/challenge-006/fred-zinn/README b/challenge-006/fred-zinn/README new file mode 100644 index 0000000000..17bac4f094 --- /dev/null +++ b/challenge-006/fred-zinn/README @@ -0,0 +1 @@ +Solution by Fred Zinn diff --git a/challenge-006/freddie-b/README b/challenge-006/freddie-b/README new file mode 100644 index 0000000000..823d7474b5 --- /dev/null +++ b/challenge-006/freddie-b/README @@ -0,0 +1 @@ +Solution by Freddie B diff --git a/challenge-006/guillermo-ramos/README b/challenge-006/guillermo-ramos/README new file mode 100644 index 0000000000..a39eb01bff --- /dev/null +++ b/challenge-006/guillermo-ramos/README @@ -0,0 +1 @@ +Solution by Guillermo Ramos. diff --git a/challenge-006/gustavo-chaves/README b/challenge-006/gustavo-chaves/README new file mode 100644 index 0000000000..a66bbbf8a3 --- /dev/null +++ b/challenge-006/gustavo-chaves/README @@ -0,0 +1 @@ +Solution by Gustavo Chaves diff --git a/challenge-006/jacques-guinnebault/README b/challenge-006/jacques-guinnebault/README new file mode 100644 index 0000000000..9d3e7c037f --- /dev/null +++ b/challenge-006/jacques-guinnebault/README @@ -0,0 +1 @@ +Solution by Jacques Guinnebault. diff --git a/challenge-006/jaime/README b/challenge-006/jaime/README new file mode 100644 index 0000000000..46e62dafa4 --- /dev/null +++ b/challenge-006/jaime/README @@ -0,0 +1,23 @@ +Solution by Jaime Corchado, (@tortsnare)[https://twitter.com/tortsnare]. + +#Challenge #1 +Write a program which prints out all anagrams for a given word. + +## Solution +Lookup anagrams in a hash of Engligh words. + +The script does initialize a list of words from Webster's Second International dictionary, + but I removed any hyphenated or capitalized words. + +All words are keyed by alphabetical order. `join "", sort split //` +Words that are anagrams of one another share the same key. +Words that are not anagrams, do not share a key. + +The script reports the anagrams of its arguments by looking up all words that share the key. + +#Challenge #2 +Write a program to find the sequence of characters that has the most. + +## Solution +The English words are hashed as before. +The script tracks the key with the most additions. diff --git a/challenge-006/jaldhar-h-vyas/README b/challenge-006/jaldhar-h-vyas/README new file mode 100644 index 0000000000..7dce927eca --- /dev/null +++ b/challenge-006/jaldhar-h-vyas/README @@ -0,0 +1 @@ +Solution by Jaldhar H. Vyas diff --git a/challenge-006/james-smith/README b/challenge-006/james-smith/README new file mode 100644 index 0000000000..573d9eb02a --- /dev/null +++ b/challenge-006/james-smith/README @@ -0,0 +1 @@ +Solution by James Smith diff --git a/challenge-006/jeff/README b/challenge-006/jeff/README new file mode 100644 index 0000000000..d5f15f4a8e --- /dev/null +++ b/challenge-006/jeff/README @@ -0,0 +1 @@ +Solution by Jeff diff --git a/challenge-006/jeremy-carman/README b/challenge-006/jeremy-carman/README new file mode 100644 index 0000000000..3d08510e49 --- /dev/null +++ b/challenge-006/jeremy-carman/README @@ -0,0 +1 @@ +Solution by Jeremy Carman diff --git a/challenge-006/jim-bacon/README b/challenge-006/jim-bacon/README new file mode 100644 index 0000000000..8dcfd637a3 --- /dev/null +++ b/challenge-006/jim-bacon/README @@ -0,0 +1 @@ +Solution by Jim Bacon diff --git a/challenge-006/jj-merelo/README b/challenge-006/jj-merelo/README new file mode 100644 index 0000000000..d09838676b --- /dev/null +++ b/challenge-006/jj-merelo/README @@ -0,0 +1 @@ +Solution by JJ Merelo diff --git a/challenge-006/jo-christian-oterhals/README b/challenge-006/jo-christian-oterhals/README new file mode 100644 index 0000000000..eafff999fb --- /dev/null +++ b/challenge-006/jo-christian-oterhals/README @@ -0,0 +1 @@ +Solution by Jo Christian Oterhals diff --git a/challenge-006/joelle-maslak/README b/challenge-006/joelle-maslak/README new file mode 100644 index 0000000000..d12c7940c3 --- /dev/null +++ b/challenge-006/joelle-maslak/README @@ -0,0 +1 @@ +Solution by Joelle Maslak diff --git a/challenge-006/joelle-maslak/perl5/ch-1.pl b/challenge-006/joelle-maslak/perl5/ch-1.pl new file mode 100755 index 0000000000..f01b07d0ce --- /dev/null +++ b/challenge-006/joelle-maslak/perl5/ch-1.pl @@ -0,0 +1,37 @@ +#!/usr/bin/env perl +use v5.26; +use strict; +use warnings; + +# Turn on method signatures +use feature 'signatures'; +no warnings 'experimental::signatures'; + +use autodie; + +# To call this application: +# +# perl ch-1.pl <numbers> +# +# Numbers should be space seperated. +# + +my $run; +my @runs; + +for my $num ( sort( { $a <=> $b } @ARGV ) ) { + if ( !defined $run ) { + $run = [ $num, $num ]; + } else { + if ( $run->[1] == $num - 1 ) { + $run->[1] = $num; + } else { + push @runs, $run; + $run = [ $num, $num ]; + } + } +} +push @runs, $run if defined $run; + +say join( ",", map( { ( $_->[0] != $_->[1] ) ? join( '-', @$_ ) : $_->[0] } @runs ) ); + diff --git a/challenge-006/joelle-maslak/perl5/ch-2.pl b/challenge-006/joelle-maslak/perl5/ch-2.pl new file mode 100755 index 0000000000..b11ad31428 --- /dev/null +++ b/challenge-006/joelle-maslak/perl5/ch-2.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl +use v5.26; +use strict; +use warn |
