Not able to solve the problem 1-count dp

I solved this question using the approach discussed in the hint video. But my code is not able to pass all the test cases. Please help me to find errors.
Here’s my code- https://ide.codingblocks.com/s/265680.

Modified Code

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course