Skip to content

Better explanation for LCS #65

@nvmnghia

Description

@nvmnghia

Hi, I've been always NOT understanding LCS & DP in general. In the LCS explanation, these sentences

If we throw A, our LCS length will be dp[i - 1][j] (since we have prefixes S[1..i - 1] and T[1..j]). If we try to throw B character, we will have prefixes S[1..i] and T[1..j - 1] so the length of LCS will be dp[i][j - 1].

seem to claim that dp[i][j] = dp[i - 1][j] = dp[i][j - 1], which is not the case.

Can we have a better explanation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions