The Weekly Challenge - 078

Monday, Sep 14, 2020| Tags: Perl, Raku

TABLE OF CONTENTS


1. HEADLINES

2. TASK #1: Leader Element

3. TASK #2: Left Rotation

4. RECAP

5. PERL REVIEW

6. RAKU REVIEW

7. CHART

8. NEW MEMBERS

9. GUESTS


HEADLINES


Last week we announced the winner of August 2020 and today we have the interview with Cheok-Yin Fung available for everyone.


This week, we had 18 contributions by guests in 7 different languages. I would like to THANK each and every guest contributors.

1) Haskell: 6

2) Python: 5

3) Clojure: 2

4) Lisp: 2

5) C++: 1

6) HTML: 1

7) XSLT: 1


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

1) Commits: 9345 (+223)

2) Pull Requests: 2272 (+49)

3) Contributors: 131 (+7)

4) Fork: 159 (+5)

5) Stars: 76 (+2)


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


TASK #1 › Leader Element

Submitted by: Mohammad S Anwar

You are given an array @A containing distinct integers.

Write a script to find all leader elements in the array @A. Print (0) if none found.

An element is leader if it is greater than all the elements to its right side.

Example 1:

Input: @A = (9, 10, 7, 5, 6, 1)
Output: (10, 7, 6, 1)

Example 2:

Input: @A = (3, 4, 5)
Output: (5)


TASK #2 › Left Rotation

Submitted by: Mohammad S Anwar

You are given array @A containing positive numbers and @B containing one or more indices from the array @A.

Write a script to left rotate @A so that the number at the first index of @B becomes the first element in the array. Similary, left rotate @A again so that the number at the second index of @B becomes the first element in the array.

Example 1:

Input:
    @A = (10 20 30 40 50)
    @B = (3 4)

Explanation:

a) We left rotate the 3rd index element (40) in the @A to make it 0th index member in the array.
        [40 50 10 20 30]

b) We left rotate the 4th index element (50) in the @A to make it 0th index member in the array.
        [50 10 20 30 40]

Output:
    [40 50 10 20 30]
    [50 10 20 30 40]

Example 2:

Input:
    @A = (7 4 2 6 3)
    @B = (1 3 4)

Explanation:

a) We left rotate the 1st index element (4) in the @A to make it 0th index member in the array.
        [4 2 6 3 7]

b) We left rotate the 3rd index element (6) in the @A to make it 0th index member in the array.
        [6 3 7 4 2]

c) We left rotate the 4th index element (3) in the @A to make it 0th index member in the array.
        [3 7 4 2 6]

Output:
    [4 2 6 3 7]
    [6 3 7 4 2]
    [3 7 4 2 6]

RECAP


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


PERL REVIEW


Please checkout Perl solutions review of the “The Weekly Challenge - 076” by Colin Crain.

If you missed any past reviews then please checkout the collection.


RAKU REVIEW


Please checkout Raku solutions review of the “Perl Weekly Challenge - 076” by Andrew Shitov.

If you missed any past reviews then please checkout 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) Shasank Shah, an experienced Perl hacker.

2) P6steve, an experienced Raku hacker.

3) Flavio Poletti

Perl Hacker from Roma, Italia. I mainly use Perl for my own interests and stuff, trying to blog about it when possible at https://github.polettix.it/ETOOBUSY/.


With the above additions, we now have 188 members in the Team PWC.

Aviral Goel, Programming Languages student at Northeastern University, Boston, MA joined as guest.


Please find out How to contribute?, if you have any doubts.

Please give it a try to an excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


GUESTS


1) Andrew Shitov shared solution to Task #2 in C++.

2) Andrew Shitov shared solution to Task #2 in HTML.

3) Andrew Shitov shared solution to Task #2 in XSLT.

4) Aviral Goel shared solutions to Task #1 and Task #2 in Haskell.

5) Cheok-Yin Fung shared solution to Task #1 in Lisp.

6) Cheok-Yin Fung shared solution to Task #1 in Python.

7) Lubos Kolouch shared solution to Task #1 and Task #2 in Python.

8) Myoungjin Jeon shared solutions to Task #1 and Task #2 in Haskell.

9) Myoungjin Jeon shared solutions to Task #1 in Lisp.

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

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

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


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


Last date to submit the solution 23:59 (UK Time) Sunday 20th September 2020.


SO WHAT DO YOU THINK ?

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

Contact with me