Sofico interview question

a simple algorithm coding test