The Weekly Challenge - 151

Monday, Feb 7, 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 Tree Depth

10. TASK #2: Rob The House


HEADLINES


Today is the first Monday of the month and it is time to announce the next champion, Alexander Pankoff, currently ranked #49 with 62 contributions in Perl. Last week, for the first time, he shared two blogs, #1 and #2.

Let us welcome a new member, Robert Ransbottom, an expert in Raku. He shared his first contributions in Raku with us.

We reached the milestone after a gap of 2 weeks. Last time we reached 100+ contributions in the Week #147. Guest contribution is also catching up, we received 75 contributions in the Week #150 in 36 different languages.

Let’s keep sharing code and knowledge.


Blogs with Creative Title


1. Fibonacci Squared Again with Raku and Perl by Arne Sommer.

2. TWC 150: bAbAbbAb and a few Composites by Bruce Gray.

3. The 51st Little Piece of String by Colin Crain.

4. No Squares Allowed by Colin Crain.

5. Free The Squares!: The Weekly Challenge #150 by Dave Jacoby

6. Perl Weekly Challenge 150: Fibonacci and squares (again!) by Luca Ferrari,

7. Fibo, nacci, Fibonacci, nacciFibonacci, FibonaccinacciFibonacci … by Peter Campbell Smith.

8. The Weekly Challenge 150: Square-Free Words by Roger Bell_West.


GitHub Repository Stats


1. Commits: 23,162 (+136)

2. Pull Requests: 5,614 (+31)

3. Contributors: 186 (+1)

4. Fork: 240 (+2)

5. Stars: 119 (+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 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 an organisation comes forward and supports us then that would be the ultimate achievement.


RECAP


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


PERL REVIEW


Please check out Perl solutions review of the “The Weekly Challenge - 146” 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


Robert Ransbottom, an expert Raku hacker joined the 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 checkout the guest contributions for the Week #150.

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


TASK #1 › Binary Tree Depth

Submitted by: Mohammad S Anwar

You are given binary tree.

Write a script to find the minimum depth.

The minimum depth is the number of nodes from the root to the nearest leaf node (node without any children).

Example 1:

Input: '1 | 2 3 | 4 5'

                1
               / \
              2   3
             / \
            4   5

Output: 2

Example 2:

Input: '1 | 2 3 | 4 *  * 5 | * 6'

                1
               / \
              2   3
             /     \
            4       5
             \
              6
Output: 3

TASK #2 › Rob The House

Submitted by: Mohammad S Anwar

You are planning to rob a row of houses, always starting with the first and moving in the same direction. However, you can’t rob two adjacent houses.

Write a script to find the highest possible gain that can be achieved.

Example 1:

Input: @valuables = (2, 4, 5);
Output: 7

If we rob house (index=0) we get 2 and then the only house we can rob is house (index=2) where we have 5.
So the total valuables in this case is (2 + 5) = 7.

Example 2:

Input: @valuables = (4, 2, 3, 6, 5, 3);
Output: 13

The best choice would be to first rob house (index=0) then rob house (index=3) then finally house (index=5).
This would give us 4 + 6 + 3 =13.


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


SO WHAT DO YOU THINK ?

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

Contact with me