mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
Dynamic-Programming : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -22,12 +22,11 @@ function longestCommonSubsequence (x, y, str1, str2, dp) {
|
||||
}
|
||||
}
|
||||
|
||||
function main () {
|
||||
const str1 = 'ABCDGH'
|
||||
const str2 = 'AEDFHR'
|
||||
const dp = new Array(str1.length + 1).fill(0).map(x => new Array(str2.length + 1).fill(0))
|
||||
const res = longestCommonSubsequence(str1.length - 1, str2.length - 1, str1, str2, dp)
|
||||
console.log(res)
|
||||
}
|
||||
// Example
|
||||
|
||||
main()
|
||||
// const str1 = 'ABCDGH'
|
||||
// const str2 = 'AEDFHR'
|
||||
// const dp = new Array(str1.length + 1).fill(0).map(x => new Array(str2.length + 1).fill(0))
|
||||
// const res = longestCommonSubsequence(str1.length - 1, str2.length - 1, str1, str2, dp)
|
||||
|
||||
export { longestCommonSubsequence }
|
||||
|
Reference in New Issue
Block a user