Pregunta de entrevista de Cyz

Dsa question medium level..problem solving ability