Robbie Hatley's Solutions To The Weekly Challenge #268
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-05-05 through 2024-05-11 is #268. Its tasks are as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Task 268-1: Magic Number Submitted by: Mohammad Sajid Anwar You are given two arrays of integers of same size, @x and @y. Write a script to find the magic number which when added to each element of the first array gives the second array. Element order is not important. Example 1: Input: @x = (3, 7, 5) @y = (9, 5, 7) Output: 2 The magic number is 2. @x = (3, 7, 5) + 2 2 2 @y = (5, 9, 7) Example 2: Input: @x = (1, 2, 1) @y = (5, 4, 4) Output: 3 The magic number is 3. @x = (1, 2, 1) + 3 3 3 @y = (5, 4, 4) Example 3: Input: @x = (2) @y = (5) Output: 3 I'll sort both arrays then subtract the second from t