The Weekly Challenge - 192

Monday, Nov 21, 2022| 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: Binary Flip

10. TASK #2: Equal Distribution


HEADLINES


Welcome to the Week #192 of The Weekly Challenge.

Another busy week with 100+ contributions. This is the record in the history of The Weekly Challenge, we achieved the target for the 8th consecutive weeks. Thank you Team PWC for the support and encouragement.

  Week      184       185       186       187       188       189       190       191   
Perl 57 61 58 51 63 62 55 56
Raku 31 35 33 34 36 35 32 38
Blog 17 19 20 20 16 18 23 21

Last week, we had 38 regular contributors and 15 guest contributors. Thank you everyone for the support and encouragement.

Today, we are giving away Coupon #15 to Alexander Pankoff 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. 16.
17. 18.
19. 20.
21. 22.
23. 24.
25. 26.
27. 28.
29. 30.
31. 32.
33. 34.
35. 36.
37. 38.
39. 40.
41. 42.
43. 44.
45. 46.
47. 48.
49. 50.

I would like to thank every guest contributors for making it special every week. Last week we received 70 guest contributions in 26 languages.

Welcome back, Daniel Pfeiffer after the short break and thanks for sharing solutions for Task #1 and Task #2 with blog post.

Thank you, Jorg Sommrey, for introducing new guest language Maxima and sharing solution to Task #2 using the language.

Last but not the least, I would also like to thank, E. Alvarez for the blog post. Being a guest contributor, it doesn’t get space in the Weekly Recaps sections, so I decided to mention it here.

Last week, I could only find time to do just one task.


Task #1: Twice Largest     [Perl] [Raku] [Python] [Java] [Swift]

Twice Largest


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  (1200)
 2. Haskell (510)
 3. Ruby    (421)
 4. Lua     (407)
 5. C       (290)
 6. C++     (290)
 7. BQN     (265)
 8. Rust    (259)
 9. Go      (230)
10. Java    (207)

Blogs with Creative Title


1. Twice Largest Once Cute by Adam Russell.

3. Twice as Cute by Arne Sommer.

4. Counting Cute by Colin Crain.

5. permutations! by Luca Ferrari.

6. The twice largest and number of cuties by Peter Campbell Smith.

7. Large but Cute by Roger Bell_West.

8. The cute recursive function by Simon Green.


GitHub Repository Stats


1. Commits: 29,224 (+162)

2. Pull Requests: 7,117 (+44)

3. Contributors: 211

4. Fork: 267

5. Stars: 148 (+1)



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 2022. 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 2022. 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 - 191 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 #191.

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


Task 1: Binary Flip

Submitted by: Mohammad S Anwar

You are given a positive integer, $n.

Write a script to find the binary flip.

Example 1

Input: $n = 5
Output: 2

First find the binary equivalent of the given integer, 101.
Then flip the binary digits 0 -> 1 and 1 -> 0 and we get 010.
So Binary 010 => Decimal 2.

Example 2

Input: $n = 4
Output: 3

Decimal 4 = Binary 100
Flip 0 -> 1 and 1 -> 0, we get 011.
Binary 011 = Decimal 3

Example 3

Input: $n = 6
Output: 1

Decimal 6 = Binary 110
Flip 0 -> 1 and 1 -> 0, we get 001.
Binary 001 = Decimal 1

Task 2: Equal Distribution

Submitted by: Mohammad S Anwar

You are given a list of integers greater than or equal to zero, @list.

Write a script to distribute the number so that each members are same. If you succeed then print the total moves otherwise print -1.

Please follow the rules (as suggested by Neils van Dijke [2022-11-21 13:00]

1) You can only move a value of '1' per move
2) You are only allowed to move a value of '1' to a direct neighbor/adjacent cell

Example 1:

Input: @list = (1, 0, 5)
Output: 4

Move #1: 1, 1, 4
(2nd cell gets 1 from the 3rd cell)

Move #2: 1, 2, 3
(2nd cell gets 1 from the 3rd cell)

Move #3: 2, 1, 3
(1st cell get 1 from the 2nd cell)

Move #4: 2, 2, 2
(2nd cell gets 1 from the 3rd cell)

Example 2:

Input: @list = (0, 2, 0)
Output: -1

It is not possible to make each same.

Example 3:

Input: @list = (0, 3, 0)
Output: 2

Move #1: 1, 2, 0
(1st cell gets 1 from the 2nd cell)

Move #2: 1, 1, 1
(3rd cell gets 1 from the 2nd cell)


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


SO WHAT DO YOU THINK ?

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

Contact with me