The Weekly Challenge - 080

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

TABLE OF CONTENTS


1. HEADLINES

2. RECAP

3. PERL REVIEW

4. RAKU REVIEW

5. CHART

6. NEW MEMBERS

7. GUESTS

8. TASK #1: Smallest Positive Number

9. TASK #2: Count Candies


HEADLINES


Congratulations Team PWC for crossing the magic number second week in a row, once again.

Here is the list of 11 weeks when we crossed the magic number:

1) Week #001: 142

2) Week #002: 111

3) Week #030: 115

4) Week #033: 108

5) Week #048: 106

6) Week #072: 110

7) Week #073: 108

8) Week #074: 113

9) Week #075: 111

10) Week #078: 121

11) Week #079: 114


Let us welcome 4 new members, Kai Burgdorf, Pham Dao An, Rakulius and Ted Leahy in the Team PWC.

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

Bc is the new language added to the list this week by Abigail.

1) Haskell: 4

2) Python: 4

3) APL: 2

4) Awk: 2

5) C++: 2

6) Clojure: 2

7) JavaScript: 2

8) Node: 2

9) Bc: 1

10) Lisp: 1

11) Prolog: 1

12) Rust: 1


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

1) Commits: 9779 (+228)

2) Pull Requests: 2390 (+60)

3) Contributors: 136 (+1)

4) Fork: 167 (+2)

5) Stars: 78 (+1)


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

RECAP


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


PERL REVIEW


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

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


RAKU REVIEW


Please checkout Raku solutions review of the “The Weekly Challenge - 078” 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) Rakulius, an experienced Raku hacker from France.

2) Ted Leahy, an experienced Perl hacker.

3) Kai Burgdorf

I am Kai Burgdorf from Hanover, Germany and just startet programming a few years ago. At the moment I am studying Computer Science at the Leibniz University and work as a Software Developer. Perl is quiet new for me so I will do my best to solve every challenge.

4) Pham Dao An

My name is An, 23 year old and I am from VietNam. I work at Dolphin Technology and start learning Perl for checking errors and do some task in Linux. But there is no place and task for improve coding skill. Luckly I found https://perlweeklychallenge.org.


With the above additions, we now have 195 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) Abigail shared solutions to Task #1 and Task #2 in Awk.

2) Abigail shared solutions to Task #1 and Task #2 in Node.

3) Abigail shared solution to Task #1 in Bc.

4) Adam Russell shared solution to Task #1 in C++.

5) Adam Russell shared solution to Task #1 in Prolog.

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

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

8) Jonas Berlin shared solution to Task #1 in Rust.

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

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

11) Myoungjin Jeon shared solution to Task #2 in Lisp.

12) Nuno Vieira shared solutions to Task #1 and Task #2 in JavaScript.

13) Richard Park shared solutions to Task #1 and Task #2 in APL.

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

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


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


TASK #1 › Smallest Positive Number

Submitted by: Mohammad S Anwar

You are given unsorted list of integers @N.

Write a script to find out the smallest positive number missing.

Example 1:

Input: @N = (5, 2, -2, 0)
Output: 1

Example 2:

Input: @N = (1, 8, -1)
Output: 2

Example 3:

Input: @N = (2, 0, -1)
Output: 1


TASK #2 › Count Candies

Submitted by: Mohammad S Anwar

You are given rankings of @N candidates.

Write a script to find out the total candies needed for all candidates. You are asked to follow the rules below:

a) You must given at least one candy to each candidate.
b) Candidate with higher ranking get more candies than their mmediate neighbors on either side.

Example 1:

Input: @N = (1, 2, 2)

Explanation:

Applying rule #a, each candidate will get one candy. So total candies needed so far 3. Now applying rule #b, the first candidate do not get any more candy as its rank is lower than it's neighbours. The second candidate gets one more candy as it's ranking is higher than it's neighbour. Finally the third candidate do not get any extra candy as it's ranking is not higher than neighbour. Therefore total candies required is 4.

Output: 4

Example 2:

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

Explanation:

Applying rule #a, each candidate will get one candy. So total candies needed so far 4. Now applying rule #b, the first candidate do not get any more candy as its rank is lower than it's neighbours. The second candidate gets two more candies as it's ranking is higher than it's both neighbour. The third candidate gets one more candy as it's ranking is higher than it's neighbour. Finally the fourth candidate do not get any extra candy as it's ranking is not higher than neighbour. Therefore total candies required is 7.

Output: 7


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


SO WHAT DO YOU THINK ?

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

Contact with me