Dextrasys Interview Question

Given a test case to code