//The answer is simple the only tricky thing is the ans+=right-left+1; because of which I got stuck //Here's an amazing explanation for that | taken form https ...
1) Need some function or array that represents ans to the problem (dp array) 2) Way to transition b/w states (recurrence relation), depends on question 3) Need a base case (initial solution for every ...