The Weekly Challenge - 250

Monday, Jan 1, 2024| Tags: Perl, Raku










09. TASK #1: Smallest Index

10. TASK #2: Alphanumeric String Value


Welcome to the Week #250 of The Weekly Challenge.

Happy New Year 2024 everyone. I hope it brings all the happiness in your life.

We all reached another milestone, i.e. entered the Week #250 of the weekly challenge. It feels so unreal.

What a great way to start the new year with the announcement of next champion. The last champion of the year 2023 is Kjetil Skotheim. As of today he has contributed 58 Perl solutions.

Last evening, 31st Dec, we had surprise thunderstorm in our locality. And for fun, it just burnt my broadband router. I ended up with no internet. Imagine, the panicky moment. I had so much to process the weekly challenge contributions. And on top, the kids at home wants internet back asap. I called the broadband provider, knowing 31st evening nobody would pick my phone. Surprise surprise, I got through support team. I was told, it has happened to few others too and I am not alone. I am now told to wait for the replacement to arrive in 3 working days. Life without internet is un-imaginable these days. I am somehow managing this week challenge.

By the way, the sole sponsor of monthly prize, Perl Careers, is no longer continuing in the year 2024 unfortunately. I would like to personally thank the team of Perl Careers for supporting us for so long.

Right now, I am in discussion with two people for sponsorship. It is still early days. I am not sure how long it would take to finalise. I will keep you posted.

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

  Week      Perl       Raku       Blog   
   245       53       30       28   
   246       43       26       23   
   247       42       21       22   
   248       50       29       24   
   249       51       24       23   

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

  Week      Guests       Contributions       Languages   
   245       16       53       18   
   246       10       39       14   
   247       10       37       14   
   248       10       41       13   
   249       12       46       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     (2083)
 2. Ruby       (636)
 3. Haskell    (617)
 4. Lua        (560)
 5. Rust       (486)
 6. C          (465)
 7. C++        (452)
 8. BQN        (315)
 9. Go         (311)
10. JavaScript (305)

Blogs with Creative Title

1. Equal DI by Arne Sommer.

2. I Did by Dave Jacoby.

3. the last one (for 2023)! by Luca Ferrari.

4. Pairs and ups and downs by Peter Campbell Smith.

5. Equal Match by Roger Bell_West.

GitHub Repository Stats

1. Commits: 35,884 (+106)

2. Pull Requests: 9,308 (+35)

3. Contributors: 239

4. Fork: 301

5. Stars: 164

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

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

Task 1: Smallest Index

Submitted by: Mohammad S Anwar

You are given an array of integers, @ints.

Write a script to find the smallest index i such that i mod 10 == $ints[i] otherwise return -1.

Example 1

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

i=0: 0 mod 10 = 0 == $ints[0].
i=1: 1 mod 10 = 1 == $ints[1].
i=2: 2 mod 10 = 2 == $ints[2].
All indices have i mod 10 == $ints[i], so we return the smallest index 0.

Example 2

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

i=0: 0 mod 10 = 0 != $ints[0].
i=1: 1 mod 10 = 1 != $ints[1].
i=2: 2 mod 10 = 2 == $ints[2].
i=3: 3 mod 10 = 3 != $ints[3].
2 is the only index which has i mod 10 == $ints[i].

Example 3

Input: @ints = (1, 2, 3, 4, 5, 6, 7, 8, 9, 0)
Output: -1
Explanation: No index satisfies i mod 10 == $ints[i].

Task 2: Alphanumeric String Value

Submitted by: Mohammad S Anwar

You are given an array of alphanumeric strings.

Write a script to return the maximum value of alphanumeric string in the given array.

The value of alphanumeric string can be defined as

a) The numeric representation of the string in base 10 if it is made up of digits only.
b) otherwise the length of the string

Example 1

Input: @alphanumstr = ("perl", "2", "000", "python", "r4ku")
Output: 6

"perl" consists of letters only so the value is 4.
"2" is digits only so the value is 2.
"000" is digits only so the value is 0.
"python" consits of letters so the value is 6.
"r4ku" consists of letters and digits so the value is 4.

Example 2

Input: @alphanumstr = ("001", "1", "000", "0001")
Output: 1

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


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

Contact with me