Pergunta de entrevista da empresa Amazon

Take min two element and push diff back into it.