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: Beautiful Arrangement
10. TASK #2: Nested Array
HEADLINES
Welcome to the Week #300
of The Weekly Challenge
.
Well done, Team PWC
, for achieving another milestone. Getting to the Week #300
is a big achievement, in my humble opinion. Everybody need a big round of applause. Without your support and dedication, we wouldn’t have come so far. I see the side effects of holiday season, with less noise than usual. Well I don’t blame you. I hope and wish you all a great time with your loved ones. In the meantime, enjoy the Advent Calendar
, some really magical one.
Advent Calendar 2024
Day 1: Leaping from Tree to Tree as They Float Down the Mighty Rivers of British Columbia by Dave Jacoby
.
Day 2: Special Zeroes by Jorg Sommrey
.
Day 3: Split the weakest by Peter Campbell Smith
.
Day 4: Reverse Power by Arne Sommer
.
Day 5: Odd Character / Most Frequent Word by Laurent Rosenfeld
.
Day 6: Easy Pairs - Easy Merge by Matthias Muth
.
Day 7: Smaller than Echelon by Roger Bell_West
.
Day 8: Count Sumofvaluacula by Adam Russell
.
Day 9: Target Index / Merge Items by James Smith
.
Day 10: Unique Occurrences / Dictionary Rank by Robbie Hatley
.
Day 11: Element Digit Sum / Dictionary Rank by Simon Green
.
Day 12: Max Positive Negative / Count Equal Divisible by Ali Moradi
.
Day 13: Don’t Sort It, Be Happy by Bob Lied
.
Day 14: Greatest English Letter / Target Array by W. Luis Mochan
.
Day 15: TDD for Good… strings by Lance Wicks
.
Day 16: Complete Day / Maximum Frequency by Ryan Thompson
.
Last 5 weeks
mainstream contribution stats. Thank you Team PWC
for your support and encouragements.
Week |
Perl |
Raku |
Blog |
295 |
45 | 20 | 24 |
296 |
49 | 19 | 16 |
297 |
44 | 20 | 23 |
298 |
35 | 16 | 21 |
299 |
33 | 7 | 9 |
Last 5 weeks
guest contribution stats. Thank you each and every guest contributors for your time and efforts.
Week |
Guests |
Contributions |
Languages |
295 |
10 | 45 | 18 |
296 |
11 | 49 | 17 |
297 |
13 | 53 | 18 |
298 |
9 | 45 | 19 |
299 |
9 | 42 | 16 |
TOP 10 Guest Languages
Do you see your favourite language in the Top #10
? If not then why not contribute regularly and make it to the top.
1. Python (3101)
2. Rust (812)
3. Ruby (753)
4. Haskell (729)
5. Lua (670)
6. C (589)
7. C++ (571)
8. JavaScript (516)
9. Go (440)
10. BQN (397)
Blogs with Creative Title
1. Nothing But Words by Arne Sommer.
2. Search and Replace by Jorg Sommrey.
3. Words, words and more words by Peter Campbell Smith.
4. Words, Words, What Are Words? by Roger Bell_West.
5. The one about words by Simon Green.
GitHub Repository Stats
1. Commits: 41,556 (+77
)
2. Pull Requests: 11,293 (+24
)
3. Contributors: 254
4. Fork: 321
5. Stars: 178
SPONSOR
With start of Week #268
, we have a new sponsor Lance Wicks
for the entire year 2024
. Having said we are looking for more sponsors so that we can go back to weekly winner. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com
. Thanks for your support in advance.
RECAP
Quick recap of The Weekly Challenge - 299 by Mohammad Sajid Anwar
.
PERL REVIEW
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
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
Please check out the guest contributions for the Week #299.
Please find past solutions by respected guests. Please share your creative solutions in other languages.
Task 1: Beautiful Arrangement
Submitted by: Mohammad Sajid Anwar
You are given a positive integer, $int
.
Write a script to return the number of beautiful arrangements that you can construct.
A permutation of n integers, 1-indexed, is considered a beautiful arrangement
if for every i (1 <= i <= n) either of the following is true:
1) perm[i] is divisible by i
2) i is divisible by perm[i]
Example 1
Input: $n = 2
Output: 2
1st arrangement: [1, 2]
perm[1] is divisible by i = 1
perm[2] is divisible by i = 2
2nd arrangement: [2, 1]
perm[1] is divisible by i = 1
i=2 is divisible by perm[2] = 1
Example 2
Input: $n = 1
Output: 1
Example 3
Input: $n = 10
Output: 700
Task 2: Nested Array
Submitted by: Mohammad Sajid Anwar
You are given an array of integers, @ints
of length n
containing permutation of the numbers in the range [0, n - 1]
.
Write a script to build a set, set[i] = ints[i], ints[ints[i]], ints[ints[ints[i]]], ...
, subjected to the following rules:
1. The first element in set[i] starts with the selection of elements ints[i].
2. The next element in set[i] should be ints[ints[i]], and then ints[ints[ints[i]]], and so on.
3. We stop adding right before a duplicate element occurs in set[i].
Return the longest length of a set set[i]
.
Example 1
Input: @ints = (5, 4, 0, 3, 1, 6, 2)
Output: 4
ints[0] = 5
ints[1] = 4
ints[2] = 0
ints[3] = 3
ints[4] = 1
ints[5] = 6
ints[6] = 2
One of the longest sets set[k]:
set[0] = {ints[0], ints[5], ints[6], ints[2]} = {5, 6, 2, 0}
Example 2
Input: @ints = (0, 1, 2)
Output: 1
Last date to submit the solution 23:59 (UK Time) Sunday 22nd December 2024.