Any rectification in this code:

This is the link to code and gives only one test-case correct out of three:

Try using long instead of int for the dp

It’s really helpful, thank you sir