The Weekly Challenge - 214

Monday, Apr 24, 2023| 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: Rank Score

10. TASK #2: Collect Points


HEADLINES


Welcome to the Week #214 of The Weekly Challenge.

Last week we decided to give away FREE book coupon to Leo Manfredi but unfortunately we don’t have his email address. I request Leo please share your email to perlweeklychallenge@yahoo.com so that the coupon can be shared with you.

I noticed something that most of the recently declared champions either not keen to share tech side of their life or a private person. I know it is optional but I find it really interesting to know the tech side of the champions. For example, if you checkout interview with Joelle Maslak, Adam Russell etc then you will understand what I mean. I really miss it.

We have new guest language, GP introduced by fellow Team PWC member BarrOff sharing solution to Task #1. With this addition, we now have 99 guest languages, just one short to another milestone.

Today, we are giving away Coupon #37 to Peter Meszaros for the book, Learning Perl Exercises by brian d foy. I will share the details with you in a separate email.

PAST WINNERS

  S. No.    Name S. No.  Name
1.  Cheok-Yin Fung 2.  W. Luis Mochan
3.  Robert DiCicco 4.  Kueppo Wesley
5.  Solathian 6.  Dario Mazzeo
7.  Peter Campbell Smith   8.  Kjetil Skotheim
9.  Neils van Dijke 10.  Laurent Rosenfeld  
11.  Duncan C. White 12.  Ali Moradi
13.  Jorg Sommrey 14.  James Smith
15.  Alexander Pankoff 16.  Simon Green
17.  Robbie Hatley 18.  Bob Lied
19.  Athanasius 20.  David Ferrone
21.  Thomas Kohler 22.  Adam Russell
23.  E. Choroba 24.  Pip Stuart
25.  Roger Bell_West 26.  Flavio Poletti
27.  Dave Jacoby 28.  Mariano Spadaccini
29.  Lubos Kolouch 30.  Matthew Neleigh
31.  Paulo Custodio 32.  Tyler Bird
33.  Carlos Oliveira 34.  Avery Adams
35.  Matthias Muth 36.  Leo Manfredi
37. 38.
39. 40.
41. 42.
43. 44.
45. 46.
47. 48.
49. 50.

Well done Team PWC and thank you for your support and encouragements. We now have crossed the 100+ contributions in the Week #212. However, we are now behind the target for the Week #213. Hopefully late submissions would catch up.

  Week      Perl       Raku       Blog   
   184       57       31       17   
   185       61       35       19   
   186       58       33       20   
   187       51       34       20   
   188       63       36       16   
   189       62       35       18   
   190       55       32       23   
   191       56       38       21   
   192       59       41       23   
   193       55       31       22   
   194       58       32       19   
   195       58       29       19   
   196       51       29       20   
   197       49       31       20   
   198       54       37       23   
   199       58       34       24   
   200       57       33       23   
   201       58       29       22   
   202       53       27       24   
   203       52       24       18   
   204       56       31       22   
   205       64       30       25   
   206       59       29       23   
   207       59       34       26   
   208       60       33       23   
   209       53       29       20   
   210       51       24       19   
   211       55       31       21   
   212       54       29       22   
   213       49       28       23   

I would like to thank every guest contributors for making it special every week. Last week we received 32 contributions in 13 languages by 11 guests.


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  (1474)
 2. Haskell (545)
 3. Ruby    (502)
 4. Lua     (461)
 5. C       (410)
 6. C++     (366)
 7. Rust    (346)
 8. BQN     (269)
 9. Go      (254)
10. Java    (222)

Blogs with Creative Title


1. Fun Route by Arne Sommer.

2. The Simple and the Hard by Avery Adams.

3. Another one rides the bus! by James Smith.

4. From here to there! by Luca Ferrari.

5. Evens go first and untangling the route by Peter Campbell Smith.

6. Shortest Fun by Roger Bell_West.

7. Sorting Routes by Simon Green.


GitHub Repository Stats


1. Commits: 32,051 (+171)

2. Pull Requests: 7,952 (+43)

3. Contributors: 222

4. Fork: 278 (1)

5. Stars: 152



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.


RECAP


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

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


Task 1: Rank Score

Submitted by: Mohammad S Anwar

You are given a list of scores (>=1).

Write a script to rank each score in descending order. First three will get medals i.e. G (Gold), S (Silver) and B (Bronze). Rest will just get the ranking number.

Using the standard model of giving equal scores equal rank, then advancing that number of ranks.


Example 1

Input: @scores = (1,2,4,3,5)
Output: (5,4,S,B,G)

Score 1 is the 5th rank.
Score 2 is the 4th rank.
Score 4 is the 2nd rank i.e. Silver (S).
Score 3 is the 3rd rank i.e. Bronze (B).
Score 5 is the 1st rank i.e. Gold (G).

Example 2

Input: @scores = (8,5,6,7,4)
Output: (G,4,B,S,5)

Score 8 is the 1st rank i.e. Gold (G).
Score 4 is the 4th rank.
Score 6 is the 3rd rank i.e. Bronze (B).
Score 7 is the 2nd rank i.e. Silver (S).
Score 4 is the 5th rank.

Example 3

Input: @list = (3,5,4,2)
Output: (B,G,S,4)

Example 4

Input: @scores = (2,5,2,1,7,5,1)
Output: (4,S,4,6,G,S,6)

Task 2: Collect Points

Submitted by: Mohammad S Anwar

You are given a list of numbers.

You will perform a series of removal operations. For each operation, you remove from the list N (one or more) equal and consecutive numbers, and add to your score N × N.

Determine the maximum possible score.

Example 1:

Input: @numbers = (2,4,3,3,3,4,5,4,2)
Output: 23

We see three 3's next to each other so let us remove that first and collect 3 x 3 points.
So now the list is (2,4,4,5,4,2).
Let us now remove 5 so that all 4's can be next to each other and collect 1 x 1 point.
So now the list is (2,4,4,4,2).
Time to remove three 4's and collect 3 x 3 points.
Now the list is (2,2).
Finally remove both 2's and collect 2 x 2 points.
So the total points collected is 9 + 1 + 9 + 4 => 23.

Example 2:

Input: @numbers = (1,2,2,2,2,1)
Output: 20

Remove four 2's first and collect 4 x 4 points.
Now the list is (1,1).
Finally remove the two 1's and collect 2 x 2 points.
So the total points collected is 16 + 4 => 20.

Example 3:

Input: @numbers = (1)
Output: 1

Example 4:

Input: @numbers = (2,2,2,1,1,2,2,2)
Output: 40

Remove two 1's = 2 x 2 points.
Now the list is (2,2,2,2,2,2).
Then reomove six 2's = 6 x 6 points.


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


SO WHAT DO YOU THINK ?

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

Contact with me