Pregunta de entrevista de DXC Technology

I was asked to code a complex question