ClaySys Technologies Interview Question

Purely based on the problem they given