Jefferies Interview Question

Array manipulation, SQL aggregate functions, probability