Pregunta de entrevista de Cadence Design Systems

the question consists of algorithms question cpp code question