https://ide.codingblocks.com/s/61661
third test case is showing run time
Hey Anudeep, you size of DP array is small… use DP[1051][1051];
how to decide the size of dp ?
see the conditions given