NEOFACTO Interview Question

First step to solve task