Skip to content

Commit b8a5193

Browse files
committed
Optimized the code
1 parent 595319b commit b8a5193

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Dynamic-Programming/LongestCommonSubsequence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function longestCommonSubsequence(x, y, str1, str2, dp) {
2323
function main() {
2424
const str1 = "ABCDGH"
2525
const str2 = "AEDFHR"
26-
let dp = new Array(str1.length + 1).fill(0).map(x => new Array(str2.length + 1).fill(0))
26+
const dp = new Array(str1.length + 1).fill(0).map(x => new Array(str2.length + 1).fill(0))
2727
const res = longestCommonSubsequence(str1.length - 1, str2.length - 1, str1, str2, dp)
2828
console.log(res);
2929
}

0 commit comments

Comments
 (0)