At position , compare with : If they match: No operation needed. . If they don't match, choose the cheapest:
• Replace with : • Delete : • Insert : The transition is the core of any DP solution. It defines how the answer for the current state depends on answers for previous states. Getting the transition right is often the hardest and most rewarding part.