Perl Weekly Challenge - 074

Monday, Aug 17, 2020| Tags: Perl, Raku

HEADLINES


The week #072 was full of pleasant surprises, one of them was getting past 100 contributions. The whole Team PWC needs a big round of applause. Having set the target so high, the following week #073 was under pressure to perform. Honestly speaking, it was me who wanted to get somewhere close to the peak if not beat the previous high.

To keep the followers of @PerlWChallenge up to date, I kept sharing the progress during the week. By midweek, we crossed 50+ but still not there. By Friday, we went past 70+. On Sunday evening we actually crossed the 100 mark. So technically, we have done it twice in a row. It only happened once in the past when we did it twice in a row (week #001 and week #002).


What next?


I really want to beat and not just match the previous record of 2 in a row. So I hope Team PWC would not let me down. Lets create the history in the week #074 and go past 100 one more time.

I must make this clear that we don’t count the guest contributions towards the target. We only count Perl and Raku contributions along with any blogs and videos. Having said that I am impressed with the choice of languages we received solutions in. There are plenty to keep you busy all week. You have so much to learn from these contributions. I personally thank all the guests for their support.

I would like to specially mention, Lance Wicks, a dear friend of mine, for the live streaming of weekly challenge.

Lets talk about the guest contributions this week. We had 19 contributions in 9 different languages as listed below:

1) Haskell: 4 (Myoungjin Jeon, Ulrich Rieke)

2) Lisp: 3 (Cheok-Yin Fung, Myoungjin Jeon)

3) Erlang: 2 (E. Choroba)

4) Python: 2 (Lubos Kolouch)

5) Ruby: 2 (Shawak)

6) Swift: 2 (Mohammad S Anwar)

7) Tcl: 2 (Shawn Wagner)

8) R: 1 (Wanderdoc)

9) Rust: 1 (Jonas Berlin)


Did you notice a new name in the list above?


Well, Shawn Wagner, joined the team last week and in the first week itself he joined the guest list with contributions in Tcl.

Jonas Berlin came back after a long break to be part of the guest list with his contribution in Rust. In the past he shared solutions in Raku only. While talking about comebacks, I would like to mention another name, Lubos Kolouch, who have contributed in Perl and Python regularly in the past. Shawak is another guest who made a comeback with contributions in Ruby.


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

1) Commits: 8538

2) Pull Requests: 2085

3) Fork: 144

4) Stars: 68


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 - 073” by Mohammad S Anwar.

PERL REVIEW


Please checkout Perl solutions review of the “Perl Weekly Challenge - 072” 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 - 072” 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) Pavel Kuptsov, Perl developer from Russia.

2) Shawn Wagner, an experienced Perl hacker.


With the above 2 new members, we now have 181 members in the Team PWC.

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) E. Choroba shared solutions to Task #1 and Task #2 in Erlang.

3) Jonas Berlin shared solution to Task #2 in Rust.

4) Lubos Kolouch shared solutions to Task #1 and Task #2 in Python.

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

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

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

8) Shawak shared solutions to Task #1 and Task #2 in Ruby.

9) Shawn Wagner shared solutions to Task #1 and Task #2 in Tcl.

10) 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.



TASK #1 › Majority Element

Submitted by: Mohammad S Anwar

You are given an array of integers of size $N.

Write a script to find the majority element. If none found then print -1.

Majority element in the list is the one that appears more than floor(size_of_list/2).

Example 1

Input: @A = (1, 2, 2, 3, 2, 4, 2)

Output: 2, as 2 appears 4 times in the list which is more than floor(7/2).


Example 2

Input: @A = (1, 3, 1, 2, 4, 5)

Output: -1 as none of the elements appears more than floor(6/2).



TASK #2 › FNR Character

Submitted by: Mohammad S Anwar

You are given a string $S.

Write a script to print the series of first non-repeating character (left -> right) for the given string. Print # if none found.

Example 1

Input: $S = ‘ababc’

Output: ‘abb#c’

Pass 1: “a”, the FNR character is ‘a’
Pass 2: “ab”, the FNR character is ‘b’
Pass 3: “aba”, the FNR character is ‘b’
Pass 4: “abab”, no FNR found, hence ‘#’
Pass 5: “ababc” the FNR character is ‘c’

Example 2

Input: $S = ‘xyzzyx’

Output: ‘xyzyx#’

Pass 1: “x”, the FNR character is “x”
Pass 2: “xy”, the FNR character is “y”
Pass 3: “xyz”, the FNR character is “z”
Pass 4: “xyzz”, the FNR character is “y”
Pass 5: “xyzzy”, the FNR character is “x”
Pass 6: “xyzzyx”, no FNR found, hence ‘#’

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


SO WHAT DO YOU THINK ?

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

Contact with me