Comment

avatar username

Consider the normal edit distance DP with time complexity $O(|S||T|)$, i.e.

$dp[i][j] := \text{minimum edit distance between } s[1, i] \text { and } t[1, j]$
$dp[i][j] = min\begin{cases} dp[i - 1][j] \\ dp[i][j - 1] \\ dp[i - 1][j - 1] + [s_i \neq t_j]\end{cases}$

If you analysis it carefully, it's unnecessary to consider all states with edit distance $> K$, thus for each $i$, we only need to consider $dp[i][j]$ where $i - K \leq j \leq i + K$, which reduce the complexity into $O(|S|K)$.

The actual rating of this user is 2422.

Original comment.

Statistics