mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 17:50:39 +08:00
Again some style fixed
This commit is contained in:
@ -7,12 +7,10 @@
|
|||||||
function longestCommonSubsequence (x, y, str1, str2, dp) {
|
function longestCommonSubsequence (x, y, str1, str2, dp) {
|
||||||
if (x === -1 || y === -1) {
|
if (x === -1 || y === -1) {
|
||||||
return 0
|
return 0
|
||||||
}
|
} else {
|
||||||
else {
|
if (dp[x][y] !== 0) {
|
||||||
if (dp[x][y] !== 0){
|
|
||||||
return dp[x][y]
|
return dp[x][y]
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (str1[x] === str2[y]) {
|
if (str1[x] === str2[y]) {
|
||||||
dp[x][y] = 1 + longestCommonSubsequence(x - 1, y - 1, str1, str2, dp)
|
dp[x][y] = 1 + longestCommonSubsequence(x - 1, y - 1, str1, str2, dp)
|
||||||
return dp[x][y]
|
return dp[x][y]
|
||||||
|
Reference in New Issue
Block a user