I always find myself looking at the solution for DP problems after spending an hour or so. This has happened many times, and yet I haven't developed any routine for detecting and solving the DP problems. Even when I do detect that the problem is DP, I struggle with the solution. What do I do to develop a thought process to solve DP ?








This is what I think when I try to think of a DP approach for any problem.
Harder problems require some further optimizations as well.
Just solve more DP problems :P. It comes with practice, there is no shortcut.
Back when I was a specialist, I had a very crude way of figuring out whether a problem is DP or not: try a greedy first and if it doesn't work (or you can't find a greedy solution), then maybe DP is the solution. After a lot of practice, feeling on identifying a DP problem becomes a bit of a gut feeling (but I still think that DP can many times easily handle cases where a greedy solution either miserably fails or is very hard to create).
Regarding the thought process, the way I do it is to first look at what parameters should be considered to describe the states, then defining the DP (write down what dp[i][j] precisely means). Afterwards, to find out the recurrence, I suppose that I magically found out the values of the previous states and then determine how the current state (or future state) depends on these previous states. Don't forget to look at the problem constraints (like n, m, etc.) which can sometimes give you a hint of where to start or how many states the DP could have.
You need to use your brain
I'm curious, whats the maximum number of these blogs that's been made? 100? 200?
Anyways,
Step 1. Solve all standard cses dp problems / Read online editorials. Step 2. Profit.