Jefferies interview question

Array manipulation, SQL aggregate functions, probability