Meta Interview Question

K-max in array problem with some complications