The Weekly Challenge - 288

Monday, Sep 23, 2024| Tags: Perl, Raku

TABLE OF CONTENTS


01. HEADLINES

02. SPONSOR

03. RECAP

04. PERL REVIEW

05. RAKU REVIEW

06. CHART

07. NEW MEMBERS

08. GUESTS

09. TASK #1: Closest Palindrome

10. TASK #2: Contiguous Block


HEADLINES


Welcome to the Week #288 of The Weekly Challenge.

Welcome back, Luca Ferrari, and thanks for sharing solutions in Raku, Python, Java and PostgreSQL.

Welcome back, Lubos Kolouch and thanks for sharing solutions in Perl and Python.

Thank you, Paulo Custodio, for still going strong and dealing with past challenges in Python.

Thank you, Peter Meszaros, for dealing with past challenges.

Thank you, E. Choroba, for taking time out for the blog post.

Last but not least, I would like to thank Team PWC for suggesting fun challenges.


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

  Week      Perl       Raku       Blog   
   283       62       25       16   
   284       68       23       17   
   285       61       23       18   
   286       57       25       20   
   287       50       21       27   

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

  Week      Guests       Contributions       Languages   
   283       15       67       22   
   284       20       74       24   
   285       17       72       25   
   286       14       50       21   
   287       14       63       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     (2863)
 2. Rust       (750)
 3. Ruby       (728)
 4. Haskell    (708)
 5. Lua        (641)
 6. C          (583)
 7. C++        (548)
 8. JavaScript (488)
 9. Go         (410)
10. BQN        (372)

Blogs with Creative Title


1. Strong and Valid by Arne Sommer.

2. Strength in Numbers by Bob Lied.

3. Common Passwords by Jorg Sommrey.

4. in regexp we trust! by Luca Ferrari.

5. About Passwords, Birds, and Common Regexes by Matthias Muth.

6. Strong but Valid by Packy Anderson.

7. Strong and valid by Peter Campbell Smith.

8. Strong and Valid by Roger Bell_West.

9. Good things by Simon Green.


GitHub Repository Stats


1. Commits: 40,358 (+140)

2. Pull Requests: 10,880 (+46)

3. Contributors: 253

4. Fork: 320 (+1)

5. Stars: 175



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 perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 287 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


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

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


Task 1: Closest Palindrome

Submitted by: Mohammad Sajid Anwar

You are given a string, $str, which is an integer.

Write a script to find out the closest palindrome, not including itself. If there are more than one then return the smallest.

The closest is defined as the absolute difference minimized between two integers.

Example 1

Input: $str = "123"
Output: "121"

Example 2

Input: $str = "2"
Output: "1"

There are two closest palindrome "1" and "3". Therefore we return the smallest "1".

Example 3

Input: $str = "1400"
Output: "1441"

Example 4

Input: $str = "1001"
Output: "999"

Task 2: Contiguous Block

Submitted by: Peter Campbell Smith

You are given a rectangular matrix where all the cells contain either x or o.

Write a script to determine the size of the largest contiguous block.

A contiguous block consists of elements containing the same symbol which share an edge (not just a corner) with other elements in the block, and where there is a path between any two of these elements that crosses only those shared edges.

Example 1

    Input: $matrix = [
                       ['x', 'x', 'x', 'x', 'o'],
                       ['x', 'o', 'o', 'o', 'o'],
                       ['x', 'o', 'o', 'o', 'o'],
                       ['x', 'x', 'x', 'o', 'o'],
                     ]
    Ouput: 11

        There is a block of 9 contiguous cells containing 'x'.
        There is a block of 11 contiguous cells containing 'o'.

Example 2

    Input: $matrix = [
                       ['x', 'x', 'x', 'x', 'x'],
                       ['x', 'o', 'o', 'o', 'o'],
                       ['x', 'x', 'x', 'x', 'o'],
                       ['x', 'o', 'o', 'o', 'o'],
                     ]
    Ouput: 11

        There is a block of 11 contiguous cells containing 'x'.
        There is a block of 9 contiguous cells containing 'o'.

Example 3

    Input: $matrix = [
                       ['x', 'x', 'x', 'o', 'o'],
                       ['o', 'o', 'o', 'x', 'x'],
                       ['o', 'x', 'x', 'o', 'o'],
                       ['o', 'o', 'o', 'x', 'x'],
                     ]
    Ouput: 7

        There is a block of 7 contiguous cells containing 'o'.
        There are two other 2-cell blocks of 'o'.
        There are three 2-cell blocks of 'x' and one 3-cell.


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


SO WHAT DO YOU THINK ?

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

Contact with me