Not getting what is my mistake

As far as i know my logic is correct please help https://ide.codingblocks.com/s/251365

@sateeshkumar1872
Your logic is fine.
Just Initialize your DP array with -1. It will be correct.