Pergunta de entrevista da empresa Oracle

Coding question based on OOD.