Publicis Groupe Interview Question

Explain your solution of the coding question