Dynamic Programming21 sections · 916 units
Open in Course

Edit Distance - Problem Statement

CSES 1639

Now I'll show you 2D (two-dimensional) DP on strings. This is completely different from grids or resource tracking. You're given two strings A and BB.

You can insert, delete, or replace characters. What's the minimum operations to convert A into BB? Before reading on, think: what information do you need to describe your progress? Read the problem statement carefully, noting the constraints. Try to identify the recursive structure before looking at the solution.