Perl Weekly Challenge - 073

Sunday, Aug 9, 2020| Tags: Perl, Raku

HEADLINES


What a week it has been, we crossed the 100 mark once again !!!

Congratulations, Team PWC. Last time we crossed the magic number was in the Week #046. Overall we did it 6 times.

1) Week #001: 142

2) Week #002: 109

3) Week #030: 115

4) Week #033: 108

5) Week #046: 106

6) Week #072: 108


It is also the best week for contributions in guest languages. This week we had contributions in the following languages:

1) Awk

2) C++

3) Elm

4) Haskell

5) Lisp

6) Python

7) R

8) Swift


While we are talking about contributions, lets talk about some interesting figures from GitHub.

1) Commits: 8397

2) Pull Requests: 2053

3) Fork: 140

4) Stars: 67


We have 4 new members joined as well this week, taking the total count to 179 members.

Please check out the interview with Walt Mankowski.

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

RECAP


Quick recap of the “Perl Weekly Challenge - 072” by Mohammad S Anwar.

PERL REVIEW


Please checkout Perl solutions review of the “Perl Weekly Challenge - 071” 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 - 071” 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) Jason Messer, Perl hacker from Oregon, United States.

2) Jan Krnavek, an experienced Raku hacker.

3) William West, an experienced Perl hacker.

4) Lance Wicks, an experienced Perl and Raku hacker from Southampton, UK.


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) Cheok-Yin Fung shared solution to Task #1 in Lisp.

2) Lance Wicks shared solution to Task #1 in Elm.

3) Mohammad S Anwar shared solutions to Task #1 and Task #2 in Swift.

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

5) Myoungjin Jeon shared solutions to Task #1 and Task #2 in Lisp.

6) Pete Houston shared solutions to Task #1 and Task #2 in Awk.

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

8) Ulrich Rieke shared solutions to Task #1 in **Haskell.

9) Walt Mankowski shared solutions to Task #1 and Task #2 in C++.

10) Walt Mankowski shared solutions to Task #1 and Task #2 in Python.

11) Wanderdoc shared solutions to Task #1 and Task #2 in R.


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



TASK #1 › Min Sliding Window

Submitted by: Mohammad S Anwar

You are given an array of integers @A and sliding window size $S.

Write a script to create an array of min from each sliding window.

Example

Input: @A = (1, 5, 0, 2, 9, 3, 7, 6, 4, 8) and $S = 3

Output: (0, 0, 0, 2, 3, 3, 4, 4)


[(1 5 0) 2 9 3 7 6 4 8] = Min (0)

[1 (5 0 2) 9 3 7 6 4 8] = Min (0)

[1 5 (0 2 9) 3 7 6 4 8] = Min (0)

[1 5 0 (2 9 3) 7 6 4 8] = Min (2)

[1 5 0 2 (9 3 7) 6 4 8] = Min (3)

[1 5 0 2 9 (3 7 6) 4 8] = Min (3)

[1 5 0 2 9 3 (7 6 4) 8] = Min (4)

[1 5 0 2 9 3 7 (6 4 8)] = Min (4)



TASK #2 › Smallest Neighbour

Submitted by: Mohammad S Anwar

You are given an array of integers @A.

Write a script to create an array that represents the smallest element to the left of each corresponding index. If none found then use 0.

Example 1

Input: @A = (7, 8, 3, 12, 10)

Output: (0, 7, 0, 3, 3)


For index 0, the smallest number to the left of $A[0] i.e. 7 is none, so we put 0.

For index 1, the smallest number to the left of $A[1] as compare to 8, in (7) is 7 so we put 7.

For index 2, the smallest number to the left of $A[2] as compare to 3, in (7, 8) is none, so we put 0.

For index 3, the smallest number to the left of $A[3] as compare to 12, in (7, 8, 3) is 3, so we put 3.

For index 4, the smallest number to the left of $A[4] as compare to 10, in (7, 8, 3, 12) is 3, so we put 3 again.


Example 2

Input: @A = (4, 6, 5)

Output: (0, 4, 4)


For index 0, the smallest number to the left of $A[0] is none, so we put 0.

For index 1, the smallest number to the left of $A[1] as compare to 6, in (4) is 4, so we put 4.

For index 2, the smallest number to the left of $A[2] as compare to 5, in (4, 6) is 4, so we put 4 again.


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


SO WHAT DO YOU THINK ?

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

Contact with me