The Weekly Challenge: 385

4 min read
← Back to Challenges

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: Uncommon Words

10. TASK #2: Outermost Parentheses

HEADLINES


Welcome to the Week #385 of The Weekly Challenge.

Today is the first Monday of the month and time to declare our next champion. With greate pride, I announce, Ali Moradi, as the Champion of the Month. He currently ranked #23. He has contributed in 321 solutions in Perl, 115 solutions in Raku and 126 blog posts. He is also ranked #5 in the guest leaderboard. He has contributed in 29 guest languages as of today.

Below is my contributions to the Task #1 of Week #384.

Perl: source code


sub to_base {
    my ($n, $b) = @_;
    my @d = ('0'..'9', 'A'..'Z', 'a'..'z', '+', '/');
    return $n ? to_base(int($n / $b), $b) . $d[$n % $b] : '';
}

Raku: source code


sub to-base($n, $b) {
    my @d = |('0'..'9'), |('A'..'Z'), |('a'..'z'), '+', '/';
    return $n ?? to-base($n div $b, $b) ~ @d[$n % $b] !! '';
}

Python: source code


def to_base(n, b):
    d = [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9",
        *"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
        *"abcdefghijklmnopqrstuvwxyz",
        "+",
        "/",
    ]
    return to_base(n // b, b) + d[n % b] if n else ""

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   
   380       48       23       13   
   381       43       24       13   
   382       35       20       15   
   383       46       21       16   
   384       45       19       13   


Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   380       18       93       29   
   381       16       78       26   
   382       12       51       22   
   383       12       32       11   
   384       12       36       12   

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     (4538)
 2. Rust       (1203)
 3. C          (1058)
 4. Haskell    (939)
 5. Ruby       (935)
 6. Lua        (919)
 7. C++        (741)
 8. Go         (726)
 9. JavaScript (648)
10. Java       (532)

Blogs with Creative Title


1. N Binary by Arne Sommer.

2. Special Bases by Jorg Sommrey.

3. A Helpful Module and a Recursive Pattern by Matthias Muth.

4. A heaven on earth, they call it Base-N Street by Packy Anderson.

5. Are Your Substrings Based? by Roger Bell_West.

6. Base substrings by Simon Green.

GitHub Repository Stats


1. Commits: 50,764 (+85)

2. Pull Requests: 14,492 (+32)

3. Contributors: 282

4. Fork: 353

5. Stars: 220


With start of Week #355, we have a new sponsor Marc Perry until the end of year 2026. 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. You can find more informations here.

RECAP


Quick recap of The Weekly Challenge - 384 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 #384.

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

Task 1: Uncommon Words

Submitted by: Mohammad Sajid Anwar

You are given two sentences.

Write a script to return list of all uncommon words, order is not important.

Example 1

Input: $sentence1 = "apple banana apple"
       $sentence2 = "banana orange"
Output: ("orange")

Example 2

Input: $sentence1 = "cat dog"
       $sentence2 = "bird fish"
Output: ("cat", "dog", "bird", "fish")

Example 3

Input: $sentence1 = "the quick brown fox"
       $sentence2 = "the quick"
Output: ("brown", "fox")

Example 4

Input: $sentence1 = "hello"
       $sentence2 = "hello"
Output: ()

Example 5

Input: $sentence1 = "blue blue red"
       $sentence2 = "red green green yellow"
Output: ("yellow")

Task 2: Outermost Parentheses

Submitted by: Mohammad Sajid Anwar

You are given a valid parentheses string.

Write a script to return the string after removing the outermost parentheses of every primitive string in the primitive decomposition of the given string.

Example 1

Input: $str = "()()()"
Output: ""

Primitive Decomposition: "()" + "()" + "()"

Example 2

Input: $str = "(((())))"
Output: "((()))"

Primitive Decomposition: "(((())))"

Example 3

Input: $str = "(()())(())"
Output: "()()()"

Primitive Decomposition: "(()())" + "(())"

Example 4

Input: $str = "()((()))()"
Output: "(())"

Primitive Decomposition: "()" + "((()))" + "()"

Example 5

Input: $str = "(()(()))(()())"
Output: "()(())()()"

Primitive Decomposition: "(()(()))" + "(()())"

By submitting a response to the challenge you agree that your name or pseudonym, any photograph you supply and any other personal information contained in your submission may be published on this website and the associated mobile app. Last date to submit the solution 23:59 (UK Time) Sunday 9th August 2026.