Amazon interview question

Take min two element and push diff back into it.