Perl Weekly Challenge - 056

Monday, Apr 13, 2020| Tags: Perl, Raku


As you all know how COVID-19 has affected our daily life and in this difficult time we should be grateful to all Key Workers working round the clock to save us from the deadly virus. We are proud to have one such key member, Saif Ahmed, in our team. We salute him and everyone for their dedication and hardship. I am amazed that Saif still manages to find time for the weekly challenges.

Saif Ahmed, currently ranked #033 has contributed 40 solutions in Perl and one BLOG.

    Perl Weekly Challenge - 036: Perl (2)
    Perl Weekly Challenge - 037: Perl (2)
    Perl Weekly Challenge - 038: Perl (2)
    Perl Weekly Challenge - 039: Perl (2), Blog (1)
    Perl Weekly Challenge - 040: Perl (2)
    Perl Weekly Challenge - 041: Perl (2)
    Perl Weekly Challenge - 042: Perl (2)
    Perl Weekly Challenge - 043: Perl (2)
    Perl Weekly Challenge - 044: Perl (2)
    Perl Weekly Challenge - 045: Perl (2)
    Perl Weekly Challenge - 046: Perl (2)
    Perl Weekly Challenge - 047: Perl (2)
    Perl Weekly Challenge - 048: Perl (2)
    Perl Weekly Challenge - 049: Perl (2)
    Perl Weekly Challenge - 050: Perl (2)
    Perl Weekly Challenge - 051: Perl (2)
    Perl Weekly Challenge - 052: Perl (2)
    Perl Weekly Challenge - 053: Perl (2)
    Perl Weekly Challenge - 054: Perl (2)
    Perl Weekly Challenge - 055: Perl (2)

Last but not the least, I woud like to thank each and every member for their support and encouragement.


Quick recap of the “Perl Weekly Challenge - 055” by Mohammad S Anwar.


Please checkout Perl solutions review of the “Perl Weekly Challenge - 053” and “Perl Weekly Challenge - 054” by Ryan Thompson.

If you missed any past reviews then please checkout the collection.


If you missed any past reviews then please checkout the collection.


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.


Jared Martin from Houston joined the Team PWC last week. He is an experienced Perl Hacker.

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.


Lubos Kolouch shared solutions to Task #1 and Task #2 in Python.

Richard Park shared solutions to Task #1 and Task #2 in APL.

Ulrich Rieke shared solution to Task #2 in C++.

Ulrich Rieke shared solution to Task #2 in Haskell.

User Person shared solutions to Task #1 and Task #2 in Python.

Yet Ebreo shared solutions to Task #1 and Task #2 in Ruby.

Yet Ebreo 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.



You are given an array @N of positive integers (sorted) and another non negative integer k.

Write a script to find if there exists 2 indices i and j such that A[i] - A[j] = k and i != j.

It should print the pairs of indices, if any such pairs exist.


    @N = (2, 7, 9)
    $k = 2

Output : 2,1


Path Sum

You are given a binary tree and a sum, write a script to find if the tree has a path such that adding up all the values along the path equals the given sum. Only complete paths (from root to leaf node) may be considered for a sum.


Given the below binary tree and sum = 22,

         / \
        4   8
       /   / \
      11  13  9
     /  \      \
    7    2      1

For the given binary tree, the partial path sum 5 → 8 → 9 = 22 is not valid.

The script should return the path 5 → 4 → 11 → 2 whose sum is 22.

Last date to submit the solution 23:59 (UK Time) Sunday 19th April 2020.


If you have any suggestions or ideas then please do share with us.

Contact with me