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: Convert Palindrome
10. TASK #2: Words Length Product
HEADLINES
Welcome to the Week #392 of The Weekly Challenge.
What a pleasant surprise to see my friend, Lance Wicks, back in action. Thank you for your contribution in Perl.
I am happy to see, Roger Bell_West, is back with complete set of guest language contributions. I really admire his knowledge in so many different programming languages.
There is something I wanted to share with team for some time but I was little bit hesitant.
Having spent nearly 30 years in professional life, I know there is a very thin line between professional life and personal life.
Having said, I have shared personal matters with team in the past, so why not.
I am not sure, if you noticed in the recent few weeks, I take time to process the contributions. Sometimes, I just cut short the message.
Without going into too much details, I just want to share that I am fighting with health related issues.
The workload at times, is too much to handle. So I take a break during the week.
But as soon as the Friday arrives, I have to get back in action. And it is not just the weekly challenge, as some of you know, I also edit Perl weekly newsletter every alternate week.
So when that comes on top of my weekly challenge task then it becomes really difficult. Luckily this week, no weekly newsletter for me.
Also even when I am not editing the weekly newsletter, I still have to prepare the weekly challenge section for the weekly newsletter.
Don’t get me wrong, nobody forced me to do this.
Today, I am able to write few lines because there is no full responsibility of weekly newsletter this week.
I know, I have support of many team members. You know who I am talking about. I will ask for help when I find it really hard.
Below is my contributions to the Task #1 of Week #391.
Perl: source code
sub median ($in) {
my @m = sort { $a <=> $b } map { @$_ } @$in;
my $mid = @m >> 1;
return @m % 2 ? $m[$mid] : ($m[$mid - 1] + $m[$mid]) / 2;
}
Raku: source code
sub median(@in) {
my @m = @in.map(*.Slip).flat.sort;
my $mid = @m.elems div 2;
return @m.elems % 2 ?? @m[$mid] !! (@m[$mid - 1] + @m[$mid]) / 2;
}
Python: source code
def median(arrays):
m = sorted([item for sublist in arrays for item in sublist])
mid = len(m) // 2
return float(m[mid]) if len(m) % 2 != 0 else (m[mid - 1] + m[mid]) / 2.0
Thank you Team PWC, once again.
Happy Hacking!!
Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.
Week |
Perl |
Raku |
Blog |
387 |
36 | 16 | 12 |
388 |
39 | 19 | 15 |
389 |
41 | 18 | 14 |
390 |
37 | 15 | 15 |
391 |
39 | 18 | 16 |
Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.
Week |
Guests |
Contributions |
Languages |
387 |
11 | 26 | 10 |
388 |
12 | 70 | 25 |
389 |
13 | 70 | 23 |
390 |
11 | 28 | 10 |
391 |
10 | 50 | 10 |
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 (4625)
2. Rust (1230)
3. C (1071)
4. Haskell (957)
5. Ruby (945)
6. Lua (929)
7. C++ (753)
8. Go (732)
9. JavaScript (654)
10. Java (532)
Blogs with Creative Title
1. Median Box by Arne Sommer.
2. Median Boxes by Bob Lied.
3. Arrays of Numbers, Arrays of Boxes by Matthias Muth.
4. Old King Cole Was A Merry Old Soul by Packy Anderson.
5. Medians and stacks by Peter Campbell Smith.
6. Arrange the Median Box by Roger Bell_West.
7. Arranging things by Simon Green.
GitHub Repository Stats
1. Commits: 51,388 (+80)
2. Pull Requests: 14,720 (+32)
3. Contributors: 281
4. Fork: 352
5. Stars: 220
SPONSOR
With start of Week #355, we have a new sponsor Marc Perry until the end of year 2026. 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. You can find more informations here.
RECAP
Quick recap of The Weekly Challenge - 391 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 #391.
Please find past solutions by respected guests. Please share your creative solutions in other languages.
Task 1: Convert Palindrome
Submitted by: Mohammad Sajid Anwar
You are given a string.
Write a script to convert the given string to palindrome by adding characters in front of it.
Example 1
Input: $str = "pinnipeds"
Output: "sdepinnipeds"
Example 2
Input: $str = "abcd"
Output: "dcbabcd"
Example 3
Input: $str = "bananas"
Output: "sananabananas"
Example 4
Input: $str = "dissident"
Output: "tnedissident"
Example 5
Input: $str = "cailliachs"
Output: "shcailliachs"
Task 2: Words Length Product
Submitted by: Mohammad Sajid Anwar
You are given an array of strings.
Write a script to return the maximum value of len($words[i]) * len($words[j]) where the two words do not share common letters. If no such two words exist, return 0.
Example 1
Input: @words = ("a", "ab", "abc", "d", "de", "def")
Output: 9
Two words are "abc" and "def".
Example 2
Input: @words = ("a", "aa", "aaa", "aaaa")
Output: 0
Since no two words can be chosen without sharing letters, the result is 0.
Example 3
Input: @words = ("meet", "app", "code", "sky", "bold")
Output: 16
Two words are "meet" and "bold".
Example 4
Input: @words = ("a", "ab", "abc", "abcd", "efghi")
Output: 20
Two words are "abcd" and "efghi".
Example 5
Input: @words = ("xyz", "w", "abcdefg", "hij")
Output: 21
Two words are "abcdefg" and "hij".
By submitting a response to the challenge you agree that your name or pseudonym, any photograph you supply and any other personal information contained in your submission may be published on this website and the associated mobile app. Last date to submit the solution 23:59 (UK Time) Sunday 27th September 2026.