HEADLINES
Last week, we had the opportunity to speak to the Perl Weekly Champion of last month, Alicia Bielsa. I would like to share the relationship between Perl Weekly Challenge and Perl Weekly Newsletter. I have been associated with Perl Weekly Newsletter since May 2018 as Co-Editor. The name Perl Weekly Challenge was naturally inspired by the Perl Weekly Newsletter. The Chief Editor, Gabor Szabo has been a big supporter of Perl Weekly Challenge. He has given us permanent space in his widely read and the most popular newsletter. I would like to thank, Elizabeth Mattijsen, creator of Rakudo Weekly Newsletter, for giving us regular space in the weekly newsletter.
As you all know, I have been taking part in the weekly challenge regularly and using the opportunity to learn Raku. It has been great experience so far. Thanks to the army of Raku Experts readily available to answer any questions I have. Why not you also throw your questions at them? They are available 24x7 on the Twitter platform @PerlWChallenge
.
Last but not the least, I woud like to thank each and every member for their support and encouragement.
RECAP
Quick recap of the “Perl Weekly Challenge - 056” by Mohammad S Anwar.
PERL REVIEW
If you missed any past reviews then please checkout the collection.
RAKU REVIEW
If you missed any past reviews then please checkout the collection.
CHART
Please take a look at the charts showing interesting data.
I would like to thank every member of the team for their valuable suggestions. Please do share your experience with us.
NEW MEMBERS
Leo Manfredi an experienced Perl Hacker from Turin, Italy.
Matthew Somerville an experienced Perl Hacker from UK.
Please find out How to contribute?, if you have any doubts.
Please give it a try to an excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.
GUESTS
Lubos Kolouch shared solutions to Task #1 and Task #2 in Python.
Richard Park shared solutions to Task #1 in APL.
User Person shared solutions to Task #1 and Task #2 in Python.
Please find out past solutions by respected guests. Please do share your creative solutions in other languages.
TASK #1 › Invert Tree
You are given a full binary tree of any height, similar to the one below:
Write a script to invert the tree, by mirroring the children of every node, from left to right. The expected output from the tree above would be:
The input can be any sensible machine-readable binary tree format of your choosing, and the output should be the same format.
BONUS
In addition to the above, you may wish to pretty-print your binary tree in a human readable text-based format similar to the following:
1
/ \
3 2
/ \ / \
7 6 5 4
TASK #2 › Shortest Unique Prefix
Write a script to find the shortest unique prefix for each each word in the given list. The prefixes will not necessarily be of the same length.
Sample Input
[ "alphabet", "book", "carpet", "cadmium", "cadeau", "alpine" ]
Expected Output
[ "alph", "b", "car", "cadm", "cade", "alpi" ]
Last date to submit the solution 23:59 (UK Time) Sunday 26th April 2020.