Posts

Showing posts from October, 2025

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #343 (“Zero Friend” and “Champion Team”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-10-13 through 2025-10-19 is #343. The tasks for challenge #343 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 343-1: Zero Friend Submitted by: Mohammad Sajid Anwar You are given a list of numbers. Find the number that is closest to zero and return its distance to zero. Example #1: Input: (4, 2, -1, 3, -2) Output: 1 Example #2: Input: (-5, 5, -3, 3, -1, 1) Output: 1 Example #3: Input: (7, -3, 0, 2, -8) Output: 0 Example #4: Input: (-2, -5, -1, -8) Output: 1 Example #5: Input: (-2, 2, -4, 4, -1, 1) Output: 1 I store an ascending numeric sort of the absolute values of the given numbers in an array, then return the 0th element of that array. Robbie Hatley's Perl Sol...

Robbie Hatley's Solutions, in Perl, for The Weekly Challenge #341 (“Broken Keyboard” and “Reverse Prefix”)

Image
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, with a new pair of tasks each Monday. You can find it here: The Weekly Challenge The Weekly Challenge for the week of 2025-09-29 through 2025-10-05 is #341. The tasks for challenge #341 are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 341-1: Broken Keyboard Submitted by: Mohammad Sajid Anwar You are given a string containing English letters only, and you are given a list of broken keys. Write a script to return the total words in the given sentence can be typed completely. Example #1 input: $str = 'Hello World', @keys = ('d') Expected output: 1 Example #2 input: $str = 'apple banana cherry', @keys = ('a', 'e') Expected output: 0 Example #3 input: $str = 'Coding is fun', @keys = () Expected output: 3 Example #4 input: $str = 'The Weekly Challenge', @keys = ('a','...