Sofico Interview Question

a simple algorithm coding test