Pergunta de entrevista da empresa Advansys

Coding problem to give a suggested solution idea