The Weekly Challenge: 367

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: Max Odd Binary

10. TASK #2: Conflict Events

HEADLINES


Welcome to the Week #367 of The Weekly Challenge.

We completed 7 years of the weekly challenge last week on 25th March. I published a blog post to celebrate the occassion.

Thank you Abigail for your contributions.

Thank you to all team member for helping with testing the app. Please continue for few more days. If you accepted the invitation and not installed the app yet, then please do so now. I need your help. If anyone wants to help me, please send me your email linked to Google Play Store account. I will then send you the invitation. I have had many suggestions, some already implemented and some would be done soon.

One more thing to share, we have upgrade the Hugo binary from v0.67.0-DEV to v0.159.0. It is a big jump and had to adjust few things. If you find any issues, please do let me know.



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

Perl: source code


sub count_prefixes {
    my ($str, @array) = @_;
    my $count = grep { $str =~ /^$_/ } @array;
    return $count;
}

Raku: source code


sub count-prefixes($str, @array) {
    my $count = @array.grep({ $str.starts-with($_) }).elems;
    return $count;
}

Python: source code


def count_prefixes(string, array):
    count = sum(1 for word in array if string.startswith(word))
    return count

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   
   362       56       27       21   
   363       45       18       14   
   364       55       23       17   
   365       53       22       27   
   366       51       21       20   


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

  Week      Guests       Contributions       Languages   
   362       17       68       22   
   363       13       39       12   
   364       16       73       23   
   365       18       75       28   
   366       14       73       24   

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     (4280)
 2. Rust       (1127)
 3. C          (949)
 3. Ruby       (882)
 5. Haskell    (877)
 6. Lua        (863)
 7. C++        (704)
 8. Go         (666)
 9. JavaScript (629)
10. Java       (530)

Blogs with Creative Title


1. Count the Times by Arne Sommer.

2. Could We Start Again, Please by Bob Lied.

3. Pre-Timed Counters by Jorg Sommrey.

4. what time is it? by Luca Ferrari.

5. Counting Times Without Questions by Matthias Muth.

6. The Times They Are A-Countin’ by Packy Anderson.

7. Prefixes and times? by Peter Campbell Smith.

8. The Time of the Count is Over by Roger Bell_West.

9. Happy 7th birthday TWC! by Simon Green.


GitHub Repository Stats


1. Commits: 48,694 (+132)

2. Pull Requests: 13,832 (+41)

3. Contributors: 276 (+1)

4. Fork: 347

5. Stars: 212



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 - 366 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 #366.

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

Task 1: Max Odd Binary

Submitted by: Mohammad Sajid Anwar

You are given a binary string that has at least one ‘1’.

Write a script to rearrange the bits in such a way that the resulting binary number is the maximum odd binary number and return the resulting binary string. The resulting string can have leading zeros.

Example 1

Input: $str = "1011"
Output: "1101"

"1101" is max odd binary (13).

Example 2

Input: $str = "100"
Output: "001"

"001" is max odd binary (1).

Example 3

Input: $str = "111000"
Output: "110001"

Example 4

Input: $str = "0101"
Output: "1001"

Example 5

Input: $str = "1111"
Output: "1111"

Task 2: Conflict Events

Submitted by: Mohammad Sajid Anwar

You are given two events start and end time.

Write a script to find out if there is a conflict between the two events. A conflict happens when two events have some non-empty intersection.

Example 1

Input: @event1 = ("10:00", "12:00")
       @event2 = ("11:00", "13:00")
Output: true

Both events overlap from "11:00" to "12:00".

Example 2

Input: @event1 = ("09:00", "10:30")
       @event2 = ("10:30", "12:00")
Output: false

Event1 ends exactly at 10:30 when Event2 starts.
Since the problem defines intersection as non-empty, exact boundaries touching is not a conflict.

Example 3

Input: @event1 = ("14:00", "15:30")
       @event2 = ("14:30", "16:00")
Output: true

Both events overlap from 14:30 to 15:30.

Example 4

Input: @event1 = ("08:00", "09:00")
       @event2 = ("09:01", "10:00")
Output: false

There is a 1-minute gap from "09:00" to "09:01".

Example 5

Input: @event1 = ("23:30", "00:30")
       @event2 = ("00:00", "01:00")
Output: true

They overlap from "00:00" to "00:30".

Last date to submit the solution 23:59 (UK Time) Sunday 5th April 2026.