How to identify if a problem can be solved using dp or not ?
-> If problem contains min/max/do some operation from left to right or right to left.
-> If problem can be divideable into sub-problems.
-> If constraints are relatively less.
Approach :
-> Always try thinking of a greedy approach before dp.
-> If you can find any counter-test case, move to dp then.
-> Check constraints(if given)
-> Taking care of constraints, try defining a dp state
-> Write the definition of the dp state in comments before implementing it in code
-> Try to reduce the dimension of dp state if possible
-> Now try finding sequential/Divide&Conquer relation among dp state.
-> If not getting relation, try some operations like sorting the array .
This is what I generally follow.
If it helps, please do upvote, It is my first general post .
Kindly ask any query, if you have.