Vodafone Interview Question

A task was given to submit beforehand.