The Weekly Challenge - 247

Monday, Dec 11, 2023| Tags: Perl, Raku










09. TASK #1: Secret Santa

10. TASK #2: Most Frequent Letter Pair


Welcome to the Week #247 of The Weekly Challenge.

Please checkout the interview with the latest champion, Peter Meszaros. Thank you for prompt response.

We also got the interview done with the past champion, BarrOff. Thank you for the support and encouragement.

As we all know the festive season is on, I was expecting low turn out but to my surprise, we still received good response. Thanks to all the regular and dedicated contributors.

Advent Calendar 2023

 Day Article   Author
   1     Third Highest and Maximum (Bit-Wise) XOR     Laurent Rosenfeld  
   2     Maximum sum of pair minimums     Bob Lied  
   3     Minimum Index Sum / Duplicate and Missing     James Smith  
   4     Give A Little Bit     Dave Jacoby  
   5     Kill And Win / Number Collision     Avery Adams  
   6     Lead to Gold and 1 2 3     Peter Campbell Smith  
   7     Wow: Another oneliner! But also a complete BFS…!     Matthias Muth  
   8     Collect Points     Flavio Poletti  
   9     Odd one Out / Number Placement     Robbie Hatley  
   10     Sorted Matrix / Max Number     Stephen G Lynn  
   11     Sorted Squares / Travel Expenditure     W. Luis Mochan  

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

  Week      Perl       Raku       Blog   
   242       57       37       32   
   243       63       34       28   
   244       55       36       29   
   245       53       30       28   
   246       43       26       23   

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

  Week      Guests       Contributions       Languages   
   242       13       57       20   
   243       18       85       24   
   244       14       56       17   
   245       16       53       18   
   246       10       39       14   

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     (2035)
 2. Ruby       (630)
 3. Haskell    (612)
 4. Lua        (554)
 5. Rust       (475)
 6. C          (465)
 7. C++        (447)
 8. BQN        (315)
 9. Go         (305)
10. JavaScript (299)

Blogs with Creative Title

1. Out of Linear by Arne Sommer.

2. Random use of algebra by Bob Lied.

3. Uniqueness by Cheok-Yin Fung.

4. Make It Unique by Dave Jacoby.

5. Recurring Lotteries by Jorg Sommrey.

6. Brute Force Math! by Luca Ferrari.

7. 25 or 6 out of four… ty-nine by Packy Anderson.

8. Lotteries and sequences by Peter Campbell Smith.

9. Linear 49 by Roger Bell_West.

GitHub Repository Stats

1. Commits: 35,590 (+99)

2. Pull Requests: 9,209 (+39)

3. Contributors: 239

4. Fork: 301

5. Stars: 164 (+1)

Our solo sponsor Pete Sergeant has been a great support to keep us motivated. We are lucky that he agreed to continue the journey with us in the year 2023. I would like to personally thank Pete and his entire team for their generosity. It would be great if we could add few more to sponsor the prize money so that we could go back and declare weekly champions as we have done in the past. I hope and wish this will become possible in 2023. The amount doesn’t have to be huge. However, it would be nice to show off bunch of supporters. If an organisation comes forward and supports us then that would be the ultimate achievement.


Quick recap of The Weekly Challenge - 246 by Mohammad S 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.


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 #246.

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

Task 1: Secret Santa

Submitted by: Andreas Voegele

Secret Santa is a Christmas tradition in which members of a group are randomly assigned a person to whom they give a gift.

You are given a list of names. Write a script that tries to team persons from different families.

Example 1

The givers are randomly chosen but don't share family names with the receivers.

Input: @names = ('Mr. Wall',
                 'Mrs. Wall',
                 'Mr. Anwar',
                 'Mrs. Anwar',
                 'Mr. Conway',
                 'Mr. Cross',


    Mr. Conway -> Mr. Wall
    Mr. Anwar -> Mrs. Wall
    Mrs. Wall -> Mr. Anwar
    Mr. Cross -> Mrs. Anwar
    Mr. Wall -> Mr. Conway
    Mrs. Anwar -> Mr. Cross

Example 2

One gift is given to a family member.

Input: @names = ('Mr. Wall',
                 'Mrs. Wall',
                 'Mr. Anwar',


    Mr. Anwar -> Mr. Wall
    Mr. Wall -> Mrs. Wall
    Mrs. Wall -> Mr. Anwar

Task 2: Most Frequent Letter Pair

Submitted by: Jorg Sommrey

You are given a string S of lower case letters 'a'..'z'.

Write a script that finds the pair of consecutive letters in S that appears most frequently. If there is more than one such pair, chose the one that is the lexicographically first.

Example 1

Input: $s = 'abcdbca'
Output: 'bc'

'bc' appears twice in `$s`

Example 2

Input: $s = 'cdeabeabfcdfabgcd'
Output: 'ab'

'ab' and 'cd' both appear three times in $s and 'ab' is lexicographically smaller than 'cd'.

Last date to submit the solution 23:59 (UK Time) Sunday 17th December 2023.


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

Contact with me