Dextrasys interview question

Given a test case to code