The Weekly Challenge - 268

Sunday, May 5, 2024| Tags: Perl, Raku










09. TASK #1: Magic Number

10. TASK #2: Number Game


Welcome to the Week #268 of The Weekly Challenge.

Let us all welcome, Princy Mangla from India to Team PWC. She was one of the applicants of Outreachy Program. She first shared solutions to Week #263 in Perl. And then she surprised us with another solutions to Week #267 in Perl.

Welcome back Marton Polgar after the break. He mostly contributed solutions in Raku. In the past he shared solutions in Prolog as well but last week he shared solutions to Week #266 and Week #267 in PHP too.

We have another surprise by Lance Wicks as he shared solutions in Roc and Perl.

I have a good news that I want to share with Team PWC. Last week, Lance contacted me with the offer to sponsor the monthly champion prize money. As you all know, I did try once to attract the sponsor at the end of last year when Pete stopped the sponsorship. Unfortunately it didn’t work out. Because of this, first three winners of the year 2024 didn’t get any prize money. Lance has agreed to sponsor the next 12 months to begin with. I requested him if we can offer the prize money to the past three winners and he accepted my request. So in the next couple of days, I would contact the winners of Jan, Feb and Mar with regard to the prize money. Just for record, the prize money stays the same US $50. Winner would get the choice of direct cash transfer (if possible) or voucher of their choice (not limited to just Amazon Voucher).

Also today is the first Monday of the month and time to declare another champion of the month. I am happy to announce Reinier Maliepaard as our next champion. As of today he shared 13 solutions in Perl and 7 blog posts. He is an experienced Perl hacker from Netherlands who joined the Team PWC recently.

I would like to take this opportunity to thank Lance Wicks for the support. I am relieved as this has sorted the year 2024 for now. As you all know, we started with weekly winner and then shifted to monthly winner. I am hoping one day we would have enough sponsors to go back to weekly winner.

I am grateful to each and every member of Team PWC for their contributions. Thanks to their support and encouragement, we are still going steadily. Let us all keep sharing knowledge and spread the word.

Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   263       61       34       28   
   264       50       34       26   
   265       54       32       26   
   266       55       29       24   
   267       50       27       24   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   263       19       79       23   
   264       14       66       20   
   265       12       52       16   
   266       12       53       16   
   267       14       58       20   

TOP 10 Guest Languages

Do you see your favourite language in the Top #10? If not then why not contribute regularly and make it to the top.

 1. Python     (2478)
 2. Ruby       (678)
 3. Haskell    (660)
 4. Rust       (622)
 5. Lua        (598)
 6. C          (534)
 7. C++        (504)
 8. JavaScript (406)
 9. Go         (357)
10. BQN        (332)

Blogs with Creative Title

1. Every Product Counts by Arne Sommer.

2. Positively Perl Street by Bob Lied.

3. Lines and Signs by Jorg Sommrey.

4. Signs Count by Matthias Muth.

5. It’s the Product Line Sign that Counts by Packy Anderson.

6. Product lines by Peter Campbell Smith.

7. The Line is the Sign That Your Product Counts by Roger Bell_West.

GitHub Repository Stats

1. Commits: 37,937 (+102)

2. Pull Requests: 10,029 (+38)

3. Contributors: 244 (+1)

4. Fork: 308

5. Stars: 171

With start of Week #268, we have a new sponsor Lance Wicks for the entire year 2024. Having said we are looking for more sponsors so that we can go back to weekly winner. If anyone interested please get in touch with us at Thanks for your support in advance.


Quick recap of The Weekly Challenge - 267 by Mohammad Sajid Anwar.


If you missed any past reviews then please check out the collection.


If you missed any past reviews then please check out 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.


Princy Mangla, Computer Science aspirant and Perl hacker from India.

Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


Please check out the guest contributions for the Week #267.

Please find past solutions by respected guests. Please share your creative solutions in other languages.

Task 1: Magic Number

Submitted by: Mohammad Sajid Anwar

You are given two arrays of integers of same size, @x and @y.

Write a script to find the magic number that when added to each elements of one of the array gives the second array. Elements order is not important.

Example 1

Input: @x = (3, 7, 5)
       @y = (9, 5, 7)
Output: 2

The magic number is 2.
@x = (3, 7, 5)
   +  2  2  2
@y = (5, 9, 7)

Example 2

Input: @x = (1, 2, 1)
       @y = (5, 4, 4)
Output: 3

The magic number is 3.
@x = (1, 2, 1)
   +  3  3  3
@y = (5, 4, 4)

Example 3

Input: @x = (2)
       @y = (5)
Output: 3

Task 2: Number Game

Submitted by: Mohammad Sajid Anwar

You are given an array of integers, @ints, with even number of elements.

Write a script to create a new array made up of elements of the given array. Pick the two smallest integers and add it to new array in decreasing order i.e. high to low. Keep doing until the given array is empty.

Example 1

Input: @ints = (2, 5, 3, 4)
Output: (3, 2, 5, 4)

Round 1: we picked (2, 3) and push it to the new array (3, 2)
Round 2: we picked the remaining (4, 5) and push it to the new array (5, 4)

Example 2

Input: @ints = (9, 4, 1, 3, 6, 4, 6, 1)
Output: (1, 1, 4, 3, 6, 4, 9, 6)

Example 3

Input: @ints = (1, 2, 2, 3)
Output: (2, 1, 3, 2)

Last date to submit the solution 23:59 (UK Time) Sunday 12th May 2024.


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

Contact with me