TABLE OF CONTENTS
1. HEADLINES
2. SPONSOR
3. RECAP
4. PERL REVIEW
5. RAKU REVIEW
6. CHART
7. NEW MEMBERS
8. GUESTS
9. TASK #1: Echo Chamber
10. TASK #2: Spellbound Sorting
HEADLINES
Welcome to the Week #362 of The Weekly Challenge.
Welcome aboard, David Smith, and thank you for the first contributions in Raku.
Thanks to a recent push by Paulo Custodio, the C language has taken a big lead at rank #6.
Ruby and Haskell are still very close at ranks #3 and #4 respectively.
Please keep the spirit up!
Below is my contributions to the Task #1 of Week #361.
Perl: source code
sub zeckendorf {
my $n = shift;
my @f = (1, 2);
push(@f, $f[-1] + $f[-2]) while $f[-1] <= $n;
pop @f;
my @r;
for (my $i = $#f; $i >= 0; $i--) {
if ($f[$i] <= $n) {
push @r, $f[$i];
$n -= $f[$i];
}
}
return join ",", @r;
}
Raku: source code
sub zeckendorf($n is copy) {
my @f = (1, 2);
push @f, @f[*-1] + @f[*-2] while @f[*-1] <= $n;
@f.pop;
my @r;
loop (my $i = @f.end; $i >= 0; $i--) {
if @f[$i] <= $n {
push @r, @f[$i];
$n -= @f[$i];
}
}
return @r.join(",");
}
Python: source code
def zeckendorf(n):
f = [1, 2]
while f[-1] <= n:
f.append(f[-1] + f[-2])
f.pop()
r = []
i = len(f) - 1
while i >= 0:
if f[i] <= n:
r.append(f[i])
n -= f[i]
i -= 1
return ",".join(str(x) for x in r)
Thank you Team PWC, once again.
Happy Hacking!!
Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.
Week |
Perl |
Raku |
Blog |
357 |
50 | 23 | 25 |
358 |
53 | 23 | 27 |
359 |
52 | 20 | 21 |
360 |
55 | 19 | 17 |
361 |
53 | 25 | 16 |
Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.
Week |
Guests |
Contributions |
Languages |
357 |
18 | 73 | 19 |
358 |
18 | 71 | 20 |
359 |
18 | 68 | 23 |
360 |
16 | 73 | 22 |
361 |
13 | 53 | 20 |
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 (4157)
2. Rust (1107)
3. Ruby (870)
4. Haskell (867)
5. Lua (846)
6. C (740)
7. C++ (694)
8. Go (644)
9. JavaScript (622)
10. BQN (507)
Blogs with Creative Title
1. Celebrity Representation by Arne Sommer.
2. Was Fibonacci ever a Celebrity? by Marc Perry.
3. Where Everybody Knows Your Name by Packy Anderson.
4. Zeckendorf, the celebrity by Peter Campbell Smith.
5. Celebrity Zeckendorf by Roger Bell_West.
6. Representing a celebrity by Simon Green.
GitHub Repository Stats
1. Commits: 47,987 (+125)
2. Pull Requests: 13,606 (+50)
3. Contributors: 274 (+1)
4. Fork: 347
5. Stars: 210 (+1)
SPONSOR
We are looking for sponsor for monthly prize pot of US $50. 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 - 361 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
David Smith, an expert Raku hacker joined Team PWC.
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 #361.
Please find past solutions by respected guests. Please share your creative solutions in other languages.
Task 1: Echo Chamber
Submitted by: Mohammad Sajid Anwar
You are given a string containing lowercase letters.
Write a script to transform the string based on the index position of each character (starting from 0). For each character at position i, repeat it i + 1 times.
Example 1
Input: "abca"
Output: "abbcccaaaa"
Index 0: "a" -> repeated 1 time -> "a"
Index 1: "b" -> repeated 2 times -> "bb"
Index 2: "c" -> repeated 3 times -> "ccc"
Index 3: "a" -> repeated 4 times -> "aaaa"
Example 2
Input: "xyz"
Output: "xyyzzz"
Index 0: "x" -> "x"
Index 1: "y" -> "yy"
Index 2: "z" -> "zzz"
Example 3
Input: "code"
Output: "coodddeeee"
Index 0: "c" -> "c"
Index 1: "o" -> "oo"
Index 2: "d" -> "ddd"
Index 3: "e" -> "eeee"
Example 4
Input: "hello"
Output: "heelllllllooooo"
Index 0: "h" -> "h"
Index 1: "e" -> "ee"
Index 2: "l" -> "lll"
Index 3: "l" -> "llll"
Index 4: "o" -> "ooooo"
Example 5
Input: "a"
Output: "a"
Index 0: "a" -> "a"
Task 2: Spellbound Sorting
Submitted by: Peter Campbell Smith
You are given an array of integers.
Write a script to return them in alphabetical order, in any language of your choosing. Default language is English.
Example 1
Input: (6, 7, 8, 9 ,10)
Output: (8, 9, 7, 6, 10)
eight, nine, seven, six, ten
Example 2
Input: (-3, 0, 1000, 99)
Output: (-3, 99, 1000, 0)
minus three, ninety-nine, one thousand, zero
Example 3
Input: (1, 2, 3, 4, 5)
Output: (5, 2, 4, 3, 1) for French language
cinq, deux, quatre, trois, un
Output: (5, 4, 1, 3, 2) for English language
five, four, one, three, two
Example 4
Input: (0, -1, -2, -3, -4)
Output: (-4, -1, -3, -2, 0)
minus four, minus one, minus three, minus two, zero
Example 5
Input: (100, 101, 102)
Output: (100, 101, 102)
one hundred, one hundred and one, one hundred and two
Last date to submit the solution 23:59 (UK Time) Sunday 1st March 2026.