The Weekly Challenge - 086

Monday, Nov 9, 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: Pair Difference

9. TASK #2: Sudoku Puzzle


HEADLINES


Congratulations Team PWC for crossing the magic number 8th consecutive weeks. Well done and keep it up.

Contributions Summary

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

Languages Summary


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

1) Commits: 11,146 (+217)

2) Pull Requests: 2,728 (+53)

3) Contributors: 142

4) Fork: 177 (+1)

5) Stars: 82 (+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 - 085” by Mohammad S Anwar.


PERL REVIEW


Please checkout Perl solutions review of the “The Weekly Challenge - 084” 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 - 083” 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


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 solution to Task #1 in C.

2) Abigail shared solution to Task #1 in SQL.

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

4) Andrew Shitov shared solution to Task #1 in Python.

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

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

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

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

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

10) Philip Hood shared solutions to Task #1 and Task #2 in C++.

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

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

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

14) Shawn Wagner shared solution to Task #1 in OCaml.

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

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

17) Ulrich Rieke shared solution to Task #1 in C++.

18) 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 › Pair Difference

Submitted by: Mohammad S Anwar

You are given an array of integers @N and an integer $A.

Write a script to find find if there exists a pair of elements in the array whose difference is $A.

Print 1 if exists otherwise 0.

Example 1:

Input: @N = (10, 8, 12, 15, 5) and $A = 7
Output: 1 as 15 - 8 = 7

Example 2:

Input: @N = (1, 5, 2, 9, 7) and $A = 6
Output: 1 as 7 - 1 = 6

Example 3:

Input: @N = (10, 30, 20, 50, 40) and $A = 15
Output: 0


TASK #2 › Sudoku Puzzle

Submitted by: Mohammad S Anwar

You are given Sudoku puzzle (9x9).

Write a script to complete the puzzle and must respect the following rules:

a) Each row must have the numbers 1-9 occuring just once.
b) Each column must have the numbers 1-9 occuring just once.
c) The numbers 1-9 must occur just once in each of the 9 sub-boxes (3x3) of the grid.

Example:

[ _ _ _ 2 6 _ 7 _ 1 ]
[ 6 8 _ _ 7 _ _ 9 _ ]
[ 1 9 _ _ _ 4 5 _ _ ]
[ 8 2 _ 1 _ _ _ 4 _ ]
[ _ _ 4 6 _ 2 9 _ _ ]
[ _ 5 _ _ _ 3 _ 2 8 ]
[ _ _ 9 3 _ _ _ 7 4 ]
[ _ 4 _ _ 5 _ _ 3 6 ]
[ 7 _ 3 _ 1 8 _ _ _ ]

Output:

[ 4 3 5 2 6 9 7 8 1 ]
[ 6 8 2 5 7 1 4 9 3 ]
[ 1 9 7 8 3 4 5 6 2 ]
[ 8 2 6 1 9 5 3 4 7 ]
[ 3 7 4 6 8 2 9 1 5 ]
[ 9 5 1 7 4 3 6 2 8 ]
[ 5 1 9 3 2 6 8 7 4 ]
[ 2 4 8 9 5 7 1 3 6 ]
[ 7 6 3 4 1 8 2 5 9 ]

As the above puzzle respect the 3 rules including 9-sub-boxes as shown below:

[ 4 3 5 ] [ 2 6 9 ] [ 7 8 1 ]
[ 6 8 2 ] [ 5 7 1 ] [ 4 9 3 ]
[ 1 9 7 ] [ 8 3 4 ] [ 5 6 2 ]

[ 8 2 6 ] [ 1 9 5 ] [ 3 4 7 ]
[ 3 7 4 ] [ 6 8 2 ] [ 9 1 5 ]
[ 9 5 1 ] [ 7 4 3 ] [ 6 2 8 ]

[ 5 1 9 ] [ 3 2 6 ] [ 8 7 4 ]
[ 2 4 8 ] [ 9 5 7 ] [ 1 3 6 ]
[ 7 6 3 ] [ 4 1 8 ] [ 2 5 9 ]


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


SO WHAT DO YOU THINK ?

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

Contact with me