The Weekly Challenge - 257

Monday, Feb 19, 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: Smaller than Current

10. TASK #2: Reduced Row Echelon


HEADLINES


Welcome to the Week #257 of The Weekly Challenge.

What a pleasant surprise to see Andrew Shitov back and sharing solutions in Raku.

Welcome back, Clifton Wood and thanks for sharing solutions in Raku.

Thank you Mohammad Meraj Zia for sharing Java solution.

If you remember, I shared an open challenge, Prisoner's dilemma, in the Week #255 post. I am still waiting for your prisoner script in Perl. Thank you David Ferrone for sending yours.


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

  Week      Perl       Raku       Blog   
   252       54       35       23   
   253       53       29       25   
   254       53       32       26   
   255       55       30       26   
   256       57       32       26   

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

  Week      Guests       Contributions       Languages   
   252       19       72       22   
   253       17       60       19   
   254       17       62       20   
   255       17       60       18   
   256       17       63       17   

TOP 10 Guest Languages


JavaScript moved up one place second consecutive week to the rank #8. Congratulations all JavaScript contributors.

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     (2236)
 2. Ruby       (652)
 3. Haskell    (633)
 4. Lua        (578)
 5. Rust       (528)
 6. C          (481)
 7. C++        (480)
 8. JavaScript (333)
 9. Go         (327)
10. BQN        (315)

Blogs with Creative Title


1. Merged Maximum by Arne Sommer.

2. A Perfect Square Perfectly Squared by Dave Jacoby.

3. Zippairs by Jorg Sommrey.

4. Valentine’s Challenge by Luca Ferrari.

5. Merge the Maximum String Pairs by Packy Anderson.

6. Pairs, sriap and MsEtRrGiEngs by Peter Campbell Smith.

7. Maximum Strings by Roger Bell_West.

8. Matching and zipping by Simon Green.


GitHub Repository Stats


1. Commits: 36,653 (+109)

2. Pull Requests: 9,590 (+42)

3. Contributors: 243

4. Fork: 306

5. Stars: 167



In the year 2024, we are looking for new sponsor for monthly 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 - 256 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


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 #256.

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


Task 1: Smaller than Current

Submitted by: Mohammad Sajid Anwar

You are given an array of integers, @ints.

Write a script to find out how many integers are smaller than current i.e. foreach ints[i], count ints[j] < ints[i] where i != j.

Example 1

Input: @ints = (5, 2, 1, 6)
Output: (2, 1, 0, 3)

For $ints[0] = 5, there are two integers (2,1) smaller than 5.
For $ints[1] = 2, there is one integer (1) smaller than 2.
For $ints[2] = 1, there is none integer smaller than 1.
For $ints[3] = 6, there are three integers (5,2,1) smaller than 6.

Example 2

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

Example 3

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

Example 4

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

Task 2: Reduced Row Echelon

Submitted by: Ali Moradi

Given a matrix M, check whether the matrix is in reduced row echelon form.

A matrix must have the following properties to be in reduced row echelon form:

1. If a row does not consist entirely of zeros, then the first
   nonzero number in the row is a 1. We call this the leading 1.
2. If there are any rows that consist entirely of zeros, then
   they are grouped together at the bottom of the matrix.
3. In any two successive rows that do not consist entirely of zeros,
   the leading 1 in the lower row occurs farther to the right than
   the leading 1 in the higher row.
4. Each column that contains a leading 1 has zeros everywhere else
   in that column.

For example:

[
   [1,0,0,1],
   [0,1,0,2],
   [0,0,1,3]
]

The above matrix is in reduced row echelon form since the first nonzero number in each row is a 1, leading 1s in each successive row are farther to the right, and above and below each leading 1 there are only zeros.

For more information check out this wikipedia article.

Example 1

    Input: $M = [
                  [1, 1, 0],
                  [0, 1, 0],
                  [0, 0, 0]
                ]
    Output: 0

Example 2

    Input: $M = [
                  [0, 1,-2, 0, 1],
                  [0, 0, 0, 1, 3],
                  [0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0]
                ]
    Output: 1

Example 3

    Input: $M = [
                  [1, 0, 0, 4],
                  [0, 1, 0, 7],
                  [0, 0, 1,-1]
                ]
    Output: 1

Example 4

    Input: $M = [
                  [0, 1,-2, 0, 1],
                  [0, 0, 0, 0, 0],
                  [0, 0, 0, 1, 3],
                  [0, 0, 0, 0, 0]
                ]
    Output: 0

Example 5

    Input: $M = [
                  [0, 1, 0],
                  [1, 0, 0],
                  [0, 0, 0]
                ]
    Output: 0

Example 6

    Input: $M = [
                  [4, 0, 0, 0],
                  [0, 1, 0, 7],
                  [0, 0, 1,-1]
                ]
    Output: 0


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


SO WHAT DO YOU THINK ?

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

Contact with me