Skip to content
Anthony Nandaa edited this page May 24, 2017 · 1 revision

Filter and Reduce

Using filter and reduce functions, write a function sumEven(A), that takes an array, A, and sums all the even number is that array and returns sum as the result.

MaxPair

Write a function max_pair(A) that takes a list A, and returns the 2 integers (a tuple) in the array, A that make up a pair with the highest sum.

e.g. max_pair([10, 5, 6, 3, 9]) returns a tuple (Python or array for any other language) 10, 9

Clone this wiki locally