Dynamic programming relies on the principle that, in an optimal sequence of decisions or choices, each subsequence must also be optimal. During the search for a solution, it avoids full enumeration by pruning early partial decision solutions that cannot possibly lead to optimal solutions.