Pregunta de entrevista de HotWax Systems

same question which i put a solution in interview process as asked in coding test