Robbie Hatley's Solutions To The Weekly Challenge #289
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 The Weekly Challenge for the week of 2024-09-29 through 2024-10-05 is #289. Its tasks are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 289-1: "Third Maximum" Submitted by: Mohammad Sajid Anwar You are given an array of integers, @ints. Write a script to find the third distinct maximum in the given array. If third maximum doesn’t exist then return the maximum number. Example 1: Input: @ints = (5, 6, 4, 1) Output: 4 The first distinct maximum is 6. The second distinct maximum is 5. The third distinct maximum is 4. Example 2: Input: @ints = (4, 5) Output: 5 In the given array, the third maximum doesn't exist, therefore return the maximum. Example 3: Input: @ints = (1, 2, 2, 3) Output: 1 The first distinct maximum is 3. The second distinct maximum is 2. T