The Weekly Challenge - 098

Monday, Feb 1, 2021| 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: Read N-characters

10. TASK #2: Search Insert Position


HEADLINES


We are fast approaching the 100th week of the weekly challenge.

Have you got any plan?

Any suggestion to make it a special?

Do you know any fun and challenging tasks that we have not done yet for the special week?

Last week, I asked for suggestion of Award names. So far, I have received two names Witty Code Award and Warden of Code Award.

Please do share your ideas as we still have 2 weeks before the big event.

Did you notice, today is the first Monday of the month and time to announce the Champion?

Believe it or not, picking one name among so many is the most difficult task for me.

We are proud to declare Stuart Little as the first Champion of the year 2021.

I request all Perl and Raku reviewers, current and past, please send your three nominations each for year 2019 and 2020.

You should receive the formal email request soon in this regard.

I formally request all Team PWC members to nominate their favourite blogger for year 2019 and 2020.

Let’s welcome three new members to Team PWC i.e. Jan Hoogenraad, Robbie Hatley and Kai Burgdorf.

Last but not least, I would like to thank Dave Cross for patching the content for website. Much appreciated.


Contributions Summary

This week, we received 58 contributions from guests in 21 languages.

I would like to THANK each and every guest contributors.


Languages Summary


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

1. Commits: 13,903 (+310)

2. Pull Requests: 3,431 (+65)

3. Contributors: 158 (+1)

4. Fork: 200 (+3)

5. Stars: 89


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



Our solo sponsor Pete Sergeant has been a great support to keep us motivated. We are lucky that he agreed to continue the journey with us in the year 2021. I would like to personally thank Pete and his entire team for their generosity. It would be great if we could add few more to sponsor the prize money so that we could go back and declare weekly champions as we have done in the past. I hope and wish this will become possible in 2021. The amount doesn’t have to be huge. However, it would be nice to show off bunch of supporters. If a big organisation came forward and supported us then that would be the ultimate achievement.


RECAP


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


PERL REVIEW


Please check out Perl solutions review of the “Perl Weekly Challenge - 095” by Colin Crain.

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


1. Jan Hoogenraad, an experience Perl hacker.
2. Robbie Hatley, an experienced Perl hacker.
3. Kai Burgdorf, an experienced Perl hacker.

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


01. Abigail shared solutions to Task #1 and Task #2 in Awk.

02. Abigail shared solutions to Task #1 and Task #2 in Bash.

03. Abigail shared solutions to Task #1 and Task #2 in C.

04. Abigail shared solutions to Task #1 and Task #2 in Lua.

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

06. Abigail shared solutions to Task #1 and Task #2 in Python.

07. Abigail shared solutions to Task #1 and **Task #2 in Ruby.

08. Adam Russell shared solutions to Task #1 and Task #2 in Prolog.

09. Cheok-Yin Fung shared solution to Task # in Smalltalk.

10. Cristina Heredia shared solution to Task #1 in Python.

11. Frank Oosterhuis shared solution to Task #1 in Scala.

12. Laurent Rosenfeld shared solution to Task #1 in Python.

13. Laurent Rosenfeld shared solution to Task #1 in Scala.

14. Mohammad Meraj Zia shared solution to Task #1 in Java.

15. Mohammad Meraj Zia shared solution to Task #1 in Kotlin.

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

17. Paulo Custodio shared solutions to Task #1 and Task #2 in Basic.

18. Paulo Custodio shared solutions to Task #1 and Task #2 in C.

19. Paulo Custodio shared solutions to Task #1 and Task #2 in C++.

20. Paulo Custodio shared solutions to Task #1 and Task #2 in Forth.

21. Paulo Custodio shared solutions to Task #1 and Task #2 in Lua.

22. Paulo Custodio shared solutions to Task #1 and Task #2 in Python.

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

24. Richard Park shared solution to Task #1 in BQN.

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

26. Roger Bell_West shared solutions to Task #1 and Task #2 in Ruby.

27. Roger Bell_West shared solutions to Task #1 and Task #2 in Rust.

28. Stuart Little shared solutions to Task #1 and Task #2 in Haskell.

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

30. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Lua.

31. Tyler Wardhaugh shared solutions to Task #1 and Task #2 in Python.

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

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


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


TASK #1 › Read N-characters

Submitted by: Mohammad S Anwar

You are given file $FILE.

Create subroutine readN($FILE, $number) returns the first n-characters and moves the pointer to the (n+1)th character.

Example:

Input: Suppose the file (input.txt) contains "1234567890"
Output:
    print readN("input.txt", 4); # returns "1234"
    print readN("input.txt", 4); # returns "5678"
    print readN("input.txt", 4); # returns "90"


TASK #2 › Search Insert Position

Submitted by: Mohammad S Anwar

You are given a sorted array of distinct integers @N and a target $N.

Write a script to return the index of the given target if found otherwise place the target in the sorted array and return the index.

Example 1:

Input: @N = (1, 2, 3, 4) and $N = 3
Output: 2 since the target 3 is in the array at the index 2.

Example 2:

Input: @N = (1, 3, 5, 7) and $N = 6
Output: 3 since the target 6 is missing and should be placed at the index 3.

Example 3:

Input: @N = (12, 14, 16, 18) and $N = 10
Output: 0 since the target 10 is missing and should be placed at the index 0.

Example 4:

Input: @N = (11, 13, 15, 17) and $N = 19
Output: 4 since the target 19 is missing and should be placed at the index 4.


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


SO WHAT DO YOU THINK ?

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

Contact with me