mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-08 03:45:23 +08:00
Optimized the code
This commit is contained in:
@ -23,7 +23,7 @@ function longestCommonSubsequence(x, y, str1, str2, dp) {
|
||||
function main() {
|
||||
const str1 = "ABCDGH"
|
||||
const str2 = "AEDFHR"
|
||||
let dp = new Array(str1.length + 1).fill(0).map(x => new Array(str2.length + 1).fill(0))
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user