Perl Weekly Challenge has been very innovative with so many unique solutions. Thanks to all the members for participating and blogging about it. Keep the momentum up. Good luck with this week challenge, I am sure you will find it fun and enjoyable.
Here is the recap of last week challenge.
Please take a look at the charts showing interesting data.
I would like to thank everyone for your valuable suggestions. Please do share your experience with us. Good luck for the weekly challenge, enjoy.
Print all the niven numbers from 0 to 50 inclusive, each on their own line. A niven number is a non-negative number that is divisible by the sum of its digits.
A word ladder is a sequence of words [w0, w1, …, wn] such that each word wi in the sequence is obtained by changing a single character in the word wi-1. All words in the ladder must be valid English words.
Given two input words and a file that contains an ordered word list, implement a routine (e.g., find_shortest_ladder(word1, word2, wordlist)) that finds the shortest ladder between the two input words. For example, for the words cold and warm, the routine might return:
("cold", "cord", "core", "care", "card", "ward", "warm")
However, there’s a shortest ladder: (“cold”, “cord”, “card”, “ward”, “warm”).
All words in the list have the same length.
All words contain only lowercase alphabetical characters.
There are no duplicates in the word list.
The input words aren’t empty and aren’t equal but they have the same length as any word in the word list.
The routine must return a list of the words in the ladder if it exists. Otherwise, it returns an empty list.
If any of the input words is the wrong length (i.e., its length is different to a random from the word list) or isn’t in the word list, return an empty list.
DISCLAIMER: The challenge was proposed by Luis F. Uceta.
Introduction of optional third question is delayed by one more week about providing Perl implementation of a given API.
Last date to submit the solution 6 pm (UK Time) Sunday 12th May 2019.