This code is giving TLE
@avinashmallik2017 Your base case was wrong. I have made the required changes.