Coder Social home page Coder Social logo

Comments (5)

Durant35 avatar Durant35 commented on August 26, 2024

DP习题 6.7 动态规划解答思路

http://www.geeksforgeeks.org/dynamic-programming-set-12-longest-palindromic-subsequence/

  • dp[i][j]:[i, j] 区间内字符串的最长回文子序列
  • 递推公式:
    • if (s[i] == s[j]):dp[i][j] 可以在 dp[i + 1][j - 1] 的基础上增加两个回文子序列长度
    • if (s[i] != s[j]):max(dp[i + 1][j], dp[i][j - 1]),去掉i或j其中的一个字符,然后比较两种情况下所剩的字符串哪个回文子序列长

from durant35.github.io.

Durant35 avatar Durant35 commented on August 26, 2024

DP习题 6.7 直接递归解答思路

http://www.geeksforgeeks.org/dynamic-programming-set-12-longest-palindromic-subsequence/

  • Let X[0..n-1] be the input sequence of length n and L(0, n-1) be the length of the longest palindromic subsequence of X[0..n-1].
  • If last and first characters of X are same, then L(0, n-1) = L(1, n-2) + 2.
    Else L(0, n-1) = MAX (L(1, n-1), L(0, n-2)).

from durant35.github.io.

Durant35 avatar Durant35 commented on August 26, 2024

最长公共子序列

跟着编程之美学算法——最长公共子序列

from durant35.github.io.

Durant35 avatar Durant35 commented on August 26, 2024

最长递增子序列

P157 P196

300. Longest Increasing Subsequence

from durant35.github.io.

Durant35 avatar Durant35 commented on August 26, 2024

最长递增子序列

最长公共子序列

最长回文子序列

from durant35.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.