Task 1: Days Together Two friends, Foo and Bar gone on holidays seperately to the same city. You are given their schedule i.e. start date and end date. To keep the task simple, the date is in the form DD-MM and all dates belong to the same calendar year i.e. between 01-01 and 31-12. Also the year is non-leap year and both dates are inclusive. Write a script to find out for the given schedule, how many days they spent together in the city, if at all. Example 1 Input: Foo => SD: '12-01' ED: '20-01' Bar => SD: '15-01' ED: '18-01' Output: 4 days Example 2 Input: Foo => SD: '02-03' ED: '12-03' Bar => SD: '13-03' ED: '14-03' Output: 0 day Example 3 Input: Foo => SD: '02-03' ED: '12-03' Bar => SD: '11-03' ED: '15-03' Output: 2 days Example 4 Input: Foo => SD: '30-03' ED: '05-04' Bar => SD: '28-03' ED: '02-04' Output: 4 days MY NOTES: pretty easy. Let's do it by hand (no Date modules to inc-date) given all the constraints, same year, non-leap year. 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: Magical Triplets You are given a list of positive numbers, @n, having at least 3 numbers. Write a script to find the triplets (a, b, c) from the given list that satisfies the following rules. 1. a + b > c 2. b + c > a 3. a + c > b 4. a + b + c is maximum. In case, you end up with more than one triplets having the maximum then pick the triplet where a >= b >= c. Example 1 Input: @n = (1, 2, 3, 2); Output: (3, 2, 2) Example 2 Input: @n = (1, 3, 2); Output: () Example 3 Input: @n = (1, 1, 2, 3); Output: () Example 4 Input: @n = (2, 4, 3); Output: (4, 3, 2) MY NOTES: Ok, sounds like generate+test. Find all triples. Find triples that pass tests (1)..(3). Then find which triples have the maximum sum. If only, that's the answer. If more than one, use the tie break rule. GUEST LANGUAGE: As a bonus, I also had a go at translating ch-2.pl into C (look in the C directory for that).