The Weekly Challenge - 097

Monday, Jan 25, 2021| 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: Caesar Cipher

10. TASK #2: Binary Substrings


HEADLINES


Welcome to week 97. Three more weeks to go before we reach 3 digits.

If you remember, recently I asked for suggestions of ways to celebrate the big day. You still have time to send in your suggestions. In the meantime, I would like to suggest few options. I am not sure how many of you are aware of the White Camel Awards. I am thinking of doing something along the same lines.

However, I would not use the word Camel in the name as it is not just Perl but also Raku. Therefore we should come up with a name that represents both communities. We should also do this every year like the White Camel Awards. Since very soon we will be celeberating our second birthday, why not declare awards for both Year 1 and Year 2 together.

I am also thinking of having three tracks like the White Camel Awards: one each for Perl and Raku along with a Blogger category.

Now the most difficult part is how do we decide the winner?

Well again, in my humble opinion, the best person to pick the winners is the who reviews the code every week. So all the past and current Perl reviewers would pick three names each in the Perl category. Similarly, all past and current Raku reviewers would pick three names each in Raku category. For the Blogger category, I would keep it open, all members are FREE to suggest their favourites.

Once I have all the names, I would pick one name who get the most votes. In case of tie, I would pick my favourite between the two. Last, but not least, should we give prize as token of thank you? Ideally I would say Yes. But we don’t have the budget for it now, unfortunately. But I am not losing hope. There is still time before we announce the winners. I am keeping my fingers crossed.

Please feel free to share your point of view. I am open to any suggestions and criticism.

Lets get back to last week’s contributions. As has been the case in recent weeks, Stuart Little and Paulo Custodio took the limelight. While doing so, Stuart has taken a big lead in the Guest Leaders table. The gap between him and second-place Roger Bell_West is huge. Similarly, Laurent Rosenfeld is way ahead of the rest of us in the Leaders Board.

I remember when Stuart joined the team, he shared only Raku solutions initially. Last week he surprised me by sharing Perl solutions as well. Tyler Wardhaugh generally does Lua and Clojure but he surprised me last week by sharing Python solutions. But the surprise didn’t stop there. My friend, Mohammad Meraj Zia surprised me with his Kotlin solutions for the first time. I love surprises, pleasant ones, so keep them coming.


Contributions Summary

This week, we received 55 contributions from guests in 18 languages.

I would like to THANK each and every guest contributors.


Languages Summary


While we are talking about contributions, let’s share some interesting stats from the GitHub repository.

1. Commits: 13,593 (+262)

2. Pull Requests: 3,366 (+63)

3. Contributors: 157

4. Fork: 197

5. Stars: 89 (+1)


Last but not least, I would like to thank each and every member for their support and encouragement.



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 2021. 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 2021. The amount doesn’t have to be huge. However, it would be nice to show off bunch of supporters. If a big organisation came forward and supported us then that would be the ultimate achievement.


RECAP


Quick recap of the “The Weekly Challenge - 096” by Mohammad S Anwar.


PERL REVIEW


Please check out Perl solutions review of the “Perl Weekly Challenge - 094” by Colin Crain.

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 n excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


01. Abigail shared solutions to Task #1 and Task #2 in Awk.

02. Abigail shared solution to Task #1 in Bash.

03. Abigail shared solutions to Task #1 and Task #2 in C.

04. Abigail shared solutions to Task #1 and Task #2 in Lua.

05. Abigail shared solutions to Task #1 and Task #2 in Node.

06. Abigail shared solutions to Task #1 and Task #2 in Python.

07. Abigail shared solutions to Task #1 and Task #2 in Ruby.

08. Cristina Heredia shared solution to Task #1 in Python.

09. Kang-min Liu shared solutions to Task #1 and Task #2 in Janet.

10. Kang-min Liu shared solutions to Task #1 and Task #2 in Rust.

11. Laurent Rosenfeld shared solutions to Task #1 and Task #2 in Python.

12. Laurent Rosenfeld shared solution to Task #1 in Scala.

13. Mohammad Meraj Zia shared solutions to Task #1 and Task #2 in Java.

14. Mohammad Meraj Zia shared solutions to Task #1 and Task #2 in Kotlin.

15. Nuno Vieira shared solutions to Task #1 and Task #2 in JavaScript.

16. Paulo Custodio shared solutions to Task #1 and Task #2 in Basic.

17. Paulo Custodio shared solutions to Task #1 and Task #2 in C.

18. Paulo Custodio shared solutions to Task #1 and Task #2 in C++.

19. Paulo Custodio shared solutions to Task #1 and Task #2 in Forth.

20. Paulo Custodio shared solutions to Task #1 and Task #2 in Python.

21. Roger Bell_West shared solutions to Task #1 and Task #2 in Python.

22. Roger Bell_West shared solutions to Task #1 and Task #2 in Ruby.

23. Roger Bell_West shared solutions to Task #1 and Task #2 in Rust.

24. Stuart Little shared solutions to Task #1 and Task #2 in Haskell.

25. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Clojure.

26. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Lua.

27. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Python.

28. Ulrich Rieke shared solutions to Task #1 and Task #2 in C++.

29. Ulrich Rieke shared solutions to Task #1 and Task #2 in Haskell.


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


TASK #1 › Caesar Cipher

Submitted by: Mohammad S Anwar

You are given string $S containing only the letters A..Z and a number $N.

Write a script to encrypt the given string $S using a Caesar Cipher with left shift of size $N.

Example

Input: $S = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG", $N = 3
Output: "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD"

Plain:    ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher:   XYZABCDEFGHIJKLMNOPQRSTUVW

Plaintext:  THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD


TASK #2 › Binary Substrings

Submitted by: Mohammad S Anwar

You are given a binary string $B and an integer $S.

Write a script to split the binary string $B into substrings of size $S and then find the minimum number of flips required to make all substrings the same.

Example 1:

Input: $B = “101100101”, $S = 3
Output: 1

Binary Substrings:
    "101": 0 flip
    "100": 1 flip to make it "101"
    "101": 0 flip

Example 2:

Input $B = “10110111”, $S = 4
Output: 2

Binary Substrings:
    "1011": 0 flip
    "0111": 2 flips to make it "1011"


Last date to submit the solution 23:59 (UK Time) Sunday 31st January 2021.


SO WHAT DO YOU THINK ?

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

Contact with me