DP’s secret: think globally optimal, not just locally.

You have to break the problem into simpler subproblems, solving each of them just once, and building the solution combining these solved subproblems

The opposite of DP is a greedy algorithm because the latter picks the locally optimal choice at each step. And locally optimal choices may result in a bad global solution.

Algorithmic Problem Solving - Algorithms and data structures for preparing programming competitions: basic and advanced.

Programming Challenges - Data structures and algorithms. Programming challenges and competitions to improve knowledge.