mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 11:08:54 +08:00
Changed some styles as per the rule
This commit is contained in:
@ -14,10 +14,9 @@ function longestCommonSubsequence (x, y, str1, str2, dp) {
|
|||||||
}
|
}
|
||||||
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]
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dp[x][y] = Math.max(longestCommonSubsequence(x - 1, y, str1, str2, dp), longestCommonSubsequence(x, y - 1, str1, str2, dp))
|
dp[x][y] = Math.max(longestCommonSubsequence(x - 1, y, str1, str2, dp), longestCommonSubsequence(x, y - 1, str1, str2, dp))
|
||||||
return dp[x][y]
|
return dp[x][y]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user