Mphasis Interview Question

Coding and how you approach to solution