Use Slope Trick when:
DP has absolute value costs .
The range of values is too large for standard DP.
The DP function is convex. Other signals: reducing costs for scheduling with penalties, selecting values from ranges with deviation costs, partition problems with balance constraints. If you see with constraints linking consecutive , think Slope Trick. The piecewise linear shape is the giveaway.