Advansys Interview Question

Coding problem to give a suggested solution idea