Task 1: Rank Score You are given a list of scores (>=1). Write a script to rank each score in descending order. First three will get medals i.e. G (Gold), S (Silver) and B (Bronze). Rest will just get the ranking number. Use the standard model of giving equal scores equal rank, then advancing that number of ranks. Example 1 Input: @scores = (1,2,4,3,5) Output: (5,4,S,B,G) Score 1 is the 5th rank. Score 2 is the 4th rank. Score 4 is the 2nd rank i.e. Silver (S). Score 3 is the 3rd rank i.e. Bronze (B). Score 5 is the 1st rank i.e. Gold (G). Example 2 Input: @scores = (8,5,6,7,4) Output: (G,4,B,S,5) Score 8 is the 1st rank i.e. Gold (G). Score 4 is the 4th rank. Score 6 is the 3rd rank i.e. Bronze (B). Score 7 is the 2nd rank i.e. Silver (S). Score 4 is the 5th rank. Example 3 Input: @list = (3,5,4,2) Output: (B,G,S,4) Example 4 Input: @scores = (2,5,2,1,7,5,1) Output: (4,S,4,6,G,S,6) MY NOTES: sounds pretty easy, although scores (high is best) and ranks (low is best) are a little confusing. Even worse is joint ranks for equal scores. Start from the end: Gold is a label for rank 1, Single is a label for rank 2, Bronze is a label for rank 3. So work out the ranks (including the nasty joint ranks thing) and then apply the G/S/B stuff at the end. GUEST LANGUAGE: As a bonus, I've had a go at translating ch-1.pl into C, look in the C/ directory for that. Task 2: Collect Points You are given a list of numbers. You will perform a series of removal operations. For each operation, you remove from the list N (N >= 1) equal and consecutive numbers, and add to your score N x N. Determine the maximum possible score. Example 1: Input: @numbers = (2,4,3,3,3,4,5,4,2) Output: 23 We see three 3's next to each other so let us remove that first and collect 3 x 3 points. So now the list is (2,4,4,5,4,2). Let us now remove 5 so that all 4's can be next to each other and collect 1 x 1 point. So now the list is (2,4,4,4,2). Time to remove three 4's and collect 3 x 3 points. Now the list is (2,2). Finally remove both 2's and collect 2 x 2 points. So the total points collected is 9 + 1 + 9 + 4 => 23. Example 2: Input: @numbers = (1,2,2,2,2,1) Output: 20 Remove four 2's first and collect 4 x 4 points. Now the list is (1,1). Finally remove the two 1's and collect 2 x 2 points. So the total points collected is 16 + 4 => 20. Example 3: Input: @numbers = (1) Output: 1 Example 4: Input: @numbers = (2,2,2,1,1,2,2,2) Output: 40 Remove two 1's = 2 x 2 points. Now the list is (2,2,2,2,2,2). Then remove six 2's = 6 x 6 points. MY NOTES: hmmm.. that seems a bit tricky, in particular I can't immediately see whether we have do try all possible first moves (etc), or just the first move (or nth move more generally) with the greatest score contribution.. Actually, eg 4 shows that we CAN'T just take the individual move with the greatest score contribution, cos otherwise we'd take one of the "length 3" sequences and pass up the "length 6" sequence that becomes available later.. So, yes, it's a brute force "find all" type problem.. GUEST LANGUAGE: As a bonus, I had a go at translating ch-2.pl into C, a few days late: look in the C/ directory for that.