The Weekly Challenge - 292

Monday, Oct 21, 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: Twice Largest

10. TASK #2: Zuma Game


HEADLINES


Welcome to the Week #292 of The Weekly Challenge.

Let us all welcome two new Perl hackers, Tomasz Mucha and Pawel Kuciel to the Team PWC.

Thank you, Tomasc Mucha, for your first contributions in Perl.

Thank you, Pawel Kuciel, for your first contributions in Perl.

I noticed someone, non-Team PWC member, commented on contribution by fellow Team PWC member. Although, points raised is valid but the comparison seems odd.


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

  Week      Perl       Raku       Blog   
   287       52       25       28   
   288       44       18       17   
   289       66       28       31   
   290       62       27       31   
   291       54       25       16   

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

  Week      Guests       Contributions       Languages   
   287       14       63       19   
   288       10       46       16   
   289       18       72       24   
   290       16       74       22   
   291       12       44       18   

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     (2997)
 2. Rust       (776)
 3. Ruby       (736)
 4. Haskell    (715)
 5. Lua        (651)
 6. C          (589)
 7. C++        (555)
 8. JavaScript (501)
 9. Go         (424)
10. BQN        (380)

Blogs with Creative Title


1. Middle Hand by Arne Sommer.

2. The Hands We Are Dealt by Dave Jacoby.

3. No Bluffing by Matthias Muth.

4. You Got to Know When to $HOLD Them by Packy Anderson.

5. A middling deal by Peter Campbell Smith.

6. Index Poker by Roger Bell_West.

7. Index and poker games by Simon Green.


GitHub Repository Stats


1. Commits: 40,848 (+94)

2. Pull Requests: 11,041 (+37)

3. Contributors: 253

4. Fork: 320 (+1)

5. Stars: 176



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 - 291 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


1. Tomasz Mucha, an expert Perl hacker from Poland joined Team PWC.

2. Pawel Kuciel, an expert Perl hacker 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 #291.

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


Task 1: Twice Largest

Submitted by: Mohammad Sajid Anwar

You are given an array of integers, @ints, where the largest integer is unique.

Write a script to find whether the largest element in the array is at least twice as big as every element in the given array. If it is return the index of the largest element or return -1 otherwise.

Example 1

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

The largest integer is 4.
For every other elements in the given array is at least twice as big.
The index value of 4 is 1.

Example 2

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

The largest integer is 4.
4 is less than twice the value of 3, so we return -1.

Task 2: Zuma Game

Submitted by: Mohammad Sajid Anwar

You are given a single row of colored balls, $row and a random number of colored balls in $hand.

Here is the variation of Zuma game as your goal is to clear all of the balls from the board. Pick any ball from your hand and insert it in between two balls in the row or on either end of the row. If there is a group of three or more consecutive balls of the same color then remove the group of balls from the board. If there are no more balls on the board then you win the game. Repeat this process until you either win or do not have any more balls in your hand.

Write a script to minimum number of balls you have to insert to clear all the balls from the board. If you cannot clear all the balls from the board using the balls in your hand, return -1.

Example 1

Input: $board = "WRRBBW", $hand = "RB"
Output: -1

It is impossible to clear all the balls. The best you can do is:
- Insert 'R' so the board becomes WRRRBBW. WRRRBBW -> WBBW.
- Insert 'B' so the board becomes WBBBW. WBBBW -> WW.
There are still balls remaining on the board, and you are out of balls to insert.

Example 2

Input: $board = "WWRRBBWW", $hand = "WRBRW"
Output: 2

To make the board empty:
- Insert 'R' so the board becomes WWRRRBBWW. WWRRRBBWW -> WWBBWW.
- Insert 'B' so the board becomes WWBBBWW. WWBBBWW -> WWWW -> empty.
2 balls from your hand were needed to clear the board.

Example 3

Input: $board = "G", $hand = "GGGGG"
Output: 2

To make the board empty:
- Insert 'G' so the board becomes GG.
- Insert 'G' so the board becomes GGG. GGG -> empty.
2 balls from your hand were needed to clear the board.


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


SO WHAT DO YOU THINK ?

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

Contact with me