Task 1: Minimum Index Sum You are given two arrays of strings. Write a script to find out all common strings in the given two arrays with minimum index sum. If no common strings are found returns an empty list. Example 1 Input: @list1 = ("Perl", "Raku", "Love") @list2 = ("Raku", "Perl", "Hate") Output: ("Perl", "Raku") There are two common strings "Perl" and "Raku". Index sum of "Perl": 0 + 1 = 1 Index sum of "Raku": 1 + 0 = 1 Example 2 Input: @list1 = ("A", "B", "C") @list2 = ("D", "E", "F") Output: () No common string found, so no result. Example 3 Input: @list1 = ("A", "B", "C") @list2 = ("C", "A", "B") Output: ("A") There are three common strings "A", "B" and "C". Index sum of "A": 0 + 1 = 1 Index sum of "B": 1 + 2 = 3 Index sum of "C": 2 + 0 = 2 MY NOTES: very easy. Identify whether any common strings exist: set intersection. Then calculate index sum of all common strings and choose the minimum ones. Trickiest thing to work out is how to input two lists of strings - let's choose an arbitrary separator ':'.. GUEST LANGUAGE: As a bonus, I also had a go at translating ch-1.pl into C (look in the C directory for that). Task 2: Duplicate and Missing You are given an array of integers in sequence with one missing and one duplicate. Write a script to find the duplicate and missing integer in the given array. Return -1 if none found. For the sake of this task, let us assume the array contains no more than one duplicate and missing. Example 1: Input: @nums = (1,2,2,4) Output: (2,3) Duplicate is 2 and Missing is 3. Example 2: Input: @nums = 1,2,3,4 Output: -1 No duplicate and missing found. Example 3: Input: @nums = (1,2,3,3) Output: (3,4) Duplicate is 3 and Missing is 4. MY NOTES: also pretty easy - especially if the list of integers should (if it were not for the one missing and one duplicated) form the sequence 1..N. if so: the duplicate is the element where el[i] != i. The missing is the sole member of set {1..N} - all el[i] Let's generalise it slightly to B, B+1, .. B+N-1. Then: find the element where el[i] != el[0]+i, that is the duplicate, and the missing is the sole member of {B..N+N-1} - all el[i] GUEST LANGUAGE: As a bonus, I also had a go at translating ch-2.pl into C (look in the C directory for that)