Posts

Showing posts from September, 2023

Robbie Hatley's Solutions To The Weekly Challenge #235

For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle, usually with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-09-17 through 2023-09-23) is weekly challenge #235. Task 1 is as follows: Task 1: Remove One Submitted by: Mohammad S Anwar Given an array of integers, write a script to find out if removing ONLY one integer makes it strictly increasing order. Example 1: Input: @ints = (0, 2, 9, 4, 6) Output: true Removing ONLY 9 in the array makes it strictly-increasing. Example 2: Input: @ints = (5, 1, 3, 2) Output: false Example 3 Input: @ints = (2, 2, 3) Output: true I solved this by making these two subs: # Determine if a given array is strictly-increasing: sub is_strictly_increasing; # Determine if a given array can be made strictly-increasing # by removing 1 element: sub remove_one; The script I came up with was this: Robbie Hatley's Solution to The Weekly Ch...

Robbie Hatley's Solutions To The Weekly Challenge #234

For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle, usually with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-09-10 through 2023-09-16) is weekly challenge #234. Task 1 is as follows: Task 1: Common Characters Submitted by: Mohammad S Anwar You are given an array of words made up of alphabetic characters only. Write a script to return all alphabetic characters that show up in all words, including duplicates. Example 1: Input: @words = ("java", "javascript", "julia") Output: ("j", "a") Example 2 Input: @words = ("bella", "label", "roller") Output: ("e", "l", "l") Example 3 Input: @words = ("cool", "lock", "cook") Output: ("c", "o") My solution was to solve this by making these four subroutines: sub is_alpha ($aref); # Return ...

Robbie Hatley's Solutions To The Weekly Challenge #233

For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle, usually with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-09-03 through 2023-09-09) is weekly challenge #233. Task 1 is as follows: Task 1: Similar Words Submitted by: Mohammad S Anwar You are given an array of words made up of alphabetical characters only. Write a script to find the number of pairs of "similar" words. Two words are "similar" if they consist of the same characters. Example 1: Input: @words = ("aba", "aabb", "abcd", "bac", "aabc") Output: 2 Pair 1: similar words ("aba", "aabb") Pair 2: similar words ("bac", "aabc") Example 2: Input: @words = ("aabb", "ab", "ba") Output: 3 Pair 1: similar words ("aabb", "ab") Pair 2: similar words ("aabb", "ba...