Task 1: "Flip Binary You are given a binary number B, consisting of N binary digits 0 or 1: s0, s1 .. s(N-1). Choose two indices L and R such that 0 <= L <= R < N and flip the digits s(L), s(L+1) .... s(R). By flipping, we mean change 0 to 1 and vice-versa. For example, given the binary number 010, the possible flip pair results are listed below: L=0, R=0 the result binary: 110 L=0, R=1 the result binary: 100 L=0, R=2 the result binary: 101 L=1, R=1 the result binary: 000 L=1, R=2 the result binary: 001 L=2, R=2 the result binary: 011 Write a script to find the indices (L,R) that results in a binary number with maximum number of 1s. If you find more than one maximal pair L,R then print all of them. Continuing our example, note that we had three pairs (L=0, R=0), (L=0, R=2), and (L=2, R=2) that resulted in a binary number with two 1s, which was the maximum. So we would print all three pairs. My notes: sounds interesting. Do we need to first compute the maximum numbers of 1s and then compute all (L,R) pairs having that value? Hopefully not. Task 2: "Wave Array Any array N of non-unique, unsorted integers can be arranged into a wave-like array such that n1 >= n2 <= n3 >= n4 <= n5 and so on. For example, given the array [1, 2, 3, 4], possible wave arrays include [2, 1, 4, 3] or [4, 1, 3, 2], since 2 >= 1 <= 4 >= 3 and 4 >= 1 <= 3 >= 2. This is not a complete list. Write a script to print all possible wave arrays for an integer array N of arbitrary length. Notes: When considering N of any length, note that the first element is always greater than or equal to the second, and then the >=, <=, >= sequence alternates until the end of the array. " My notes: sounds cute. How to get started? possible values of n1 are any value in the array APART FROM THE SMALLEST ONE, eg given 1..4, n1=2..4 Then n2 is any other value of the array <= n1; given n1 and n2 and list of unused elements @u, n3 is any element in @u that is >= n2. eg given 1..4, and n1=2, n2=1, n3 is 3 or 4. Some sort of recursion should do the trick (initially I thought 2 mutually recursive functions, one to extend with a value LESS than or equal, the other to extend with a value GREATER than or equal, but then I collapsed that via the parameter $less).