The Weekly Challenge - 334

Monday, Aug 11, 2025| Tags: Perl, Raku

TABLE OF CONTENTS


  1. HEADLINES

  2. SPONSOR

  3. RECAP

  4. PERL REVIEW

  5. RAKU REVIEW

  6. CHART

  7. NEW MEMBERS

  8. GUESTS

  9. TASK #1: Range Sum

10. TASK #2: Nearest Valid Point


HEADLINES


Welcome to the Week #334 of The Weekly Challenge.

I apologize for missing last week’s Monday announcements, Apologies and Exciting Updates.

It is with great please that I announce Thomas Kohler as our next Champion of the Month.

Thomas was last named champion in April 2023. To date, he has contributed 268 Perl solutions and 261 blog posts. He currently holds the rank #20 on the leaderboard with a score of 1058. Congratulations, Thomas.

A quick request to our previous champion, Yitzchak Scott-Thoennes: Could you please reply to my email regarding the prize money sent on July 16, 2025? Thank you!

Please join me in welcoming, Jared Still, an expert Perl hacker to Team PWC. Thank you for sharing the first solution in Perl. We are thrilled to have you on board.

I also want to acknowledge Humberto Massa contributions for Week #332 and Week #333 which I missed last week.

Additionally, we had some late contributions to the Week #332 by Andreas Mahnke and Kjetil Skotheim. I hope you both had a wonderful holiday.

Thanks to these late submissions, the Week #332 has now crossed the magical 100+ contributions mark. With this achievement, we’ve now had four consecutive weeks with 100+ contributions, a fantastic milestone for Team PWC in the year 2025.

Welcome back, Dave Jacoby and thanks for the yet another pure tech post.

On a personal note, a very good friend recently reminded me that The Weekly Challenge has been running for over six years now. Honestly, it doesn’t feel real, what an incredible journey.

Thank you all for your continued support and enthusiasm.

Happy Hacking!!


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

  Week      Perl       Raku       Blog   
   329       46       24       25   
   330       50       29       25   
   331       52       27       23   
   332       48       30       25   
   333       50       27       25   

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

  Week      Guests       Contributions       Languages   
   329       15       46       15   
   330       12       62       19   
   331       13       62       20   
   332       13       64       21   
   333       11       56       19   

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     (3526)
 2. Rust       (966)
 3. Ruby       (813)
 4. Haskell    (799)
 5. Lua        (747)
 6. C++        (639)
 7. C          (594)
 8. JavaScript (576)
 9. Go         (523)
10. BQN        (456)

Blogs with Creative Title


  1. Straight Zeros by Arne Sommer.

  2. Odd last date letters, binary word list buddy by Bob Lied.

  3. Back in the Saddle Again by Dave Jacoby.

  4. Shift and Duplicate by Jorg Sommrey.

  5. streaming numbers by Luca Ferrari.

  6. Double O Straight (Not Stirred) by Matthias Muth.

  7. Zero is Not the End of the Line by Packy Anderson.

  8. Straight zeroes by Peter Campbell Smith.

  9. Duplicate Straights Are a Line of Zeroes by Roger Bell_West.

10. Duplicate Lines by Simon Green.


GitHub Repository Stats


1. Commits: 44,776 (+106)

2. Pull Requests: 12,456 (+40)

3. Contributors: 263 (+1)

4. Fork: 334 (+1)

5. Stars: 195



With start of Week #268, we have a new sponsor Lance Wicks until the end of year 2025. 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 perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


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


PERL REVIEW


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


RAKU REVIEW


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


Jared Still, an expert Perl hacker from Portland, Oregon joined Team PWC.

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.


GUESTS


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

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


Task 1: Range Sum

Submitted by: Mohammad Sajid Anwar

You are given a list integers and pair of indices..

Write a script to return the sum of integers between the given indices (inclusive).


Example 1

Input: @ints = (-2, 0, 3, -5, 2, -1), $x = 0, $y = 2
Output: 1

Elements between indices (0, 2) => (-2, 0, 3)
Range Sum: (-2) + 0 + 3 => 1

Example 2

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

Elements between indices (1, 3) => (-2, 3, -4)
Range Sum: (-2) + 3 + (-4) => -3

Example 3

Input: @ints = (1, 0, 2, -1, 3), $x = 3, $y = 4
Output: 2

Elements between indices (3, 4) => (-1, 3)
Range Sum: (-1) + 3 => 2

Example 4

Input: @ints = (-5, 4, -3, 2, -1, 0), $x = 0, $y = 3
Output: -2

Elements between indices (0, 3) => (-5, 4, -3, 2)
Range Sum: (-5) + 4 + (-3) + 2 => -2

Example 5

Input: @ints = (-1, 0, 2, -3, -2, 1), $x = 0, $y = 2
Output: 1

Elements between indices (0, 2) => (-1, 0, 2)
Range Sum: (-1) + 0 + 2 => 1

Task 2: Nearest Valid Point

Submitted by: Mohammad Sajid Anwar

You are given current location as two integers: x and y. You are also given a list of points on the grid.

A point is considered valid if it shares either the same x-coordinate or the same y-coordinate as the current location.

Write a script to return the index of the valid point that has the smallest Manhattan distance to the current location. If multiple valid points are tied for the smallest distance, return the one with the lowest index. If no valid points exist, return -1.


The Manhattan distance between two points (x1, y1) and (x2, y2) is calculated as: |x1 - x2| + |y1 - y2|


Example 1

Input: $x = 3, $y = 4, @points ([1, 2], [3, 1], [2, 4], [2, 3])
Output: 2

Valid points: [3, 1] (same x), [2, 4] (same y)

Manhattan distances:
    [3, 1] => |3-3| + |4-1| = 3
    [2, 4] => |3-2| + |4-4| = 1

Closest valid point is [2, 4] at index 2.

Example 2

Input: $x = 2, $y = 5, @points ([3, 4], [2, 3], [1, 5], [2, 5])
Output: 3

Valid points: [2, 3], [1, 5], [2, 5]

Manhattan distances:
    [2, 3] => 2
    [1, 5] => 1
    [2, 5] => 0

Closest valid point is [2, 5] at index 3.

Example 3

Input: $x = 1, $y = 1, @points ([2, 2], [3, 3], [4, 4])
Output: -1

No point shares x or y with (1, 1).

Example 4

Input: $x = 0, $y = 0, @points ([0, 1], [1, 0], [0, 2], [2, 0])
Output: 0

Valid points: all of them

Manhattan distances:
    [0, 1] => 1
    [1, 0] => 1
    [0, 2] => 2
    [2, 0] => 2

Tie between index 0 and 1, pick the smaller index: 0

Example 5

Input: $x = 5, $y = 5, @points ([5, 6], [6, 5], [5, 4], [4, 5])
Output: 0

Valid points: all of them
    [5, 6] => 1
    [6, 5] => 1
    [5, 4] => 1
    [4, 5] => 1

All tie, return the one with the lowest index: 0


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


SO WHAT DO YOU THINK ?

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

Contact with me