Amazon Interview Question

Take min two element and push diff back into it.