Pregunta de entrevista de Meta

K-max in array problem with some complications