Robbie Hatley's Solutions To The Weekly Challenge #249
For those not familiar with "The Weekly Challenge", it is a weekly programming puzzle with two parts, cycling every Sunday. You can find it here: The Weekly Challenge This week (2023-12-24 through 2023-12-30) is weekly challenge #249. Its tasks are as follows: Task 249-1: Equal Pairs Submitted by: Mohammad S Anwar Given an array of integers with even number of elements, write a script to divide the given array into equal pairs such that: a) Each element belongs to exactly one pair. b) The elements present in a pair are equal. Example 1: Input: @ints = (3, 2, 3, 2, 2, 2) Output: (2, 2), (3, 3), (2, 2) There are 6 elements in @ints. They should be divided into 6 / 2 = 3 pairs. @ints is divided into the pairs (2, 2), (3, 3), and (2, 2) satisfying all the conditions. Example 2: Input: @ints = (1, 2, 3, 4) Output: () There is no way to divide @ints 2 pairs such that the pairs satisfy every condition. To solve this, I made a sub that splices integers from the array and at...