My approach i correct or not

please check is correct or not, and check there is any area in which i can optimize my code or not

@shivamgoel150
Line 20
Check with DP[i/2] instead of DP[n/2]