Skip to content

Commit 196fcb3

Browse files
committed
LPS algorithm fix
1 parent 1bf0fe0 commit 196fcb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DynamicProgramming/LongestPalindromicSubsequence.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ private static String LPS(String original) {
2222
StringBuilder reverse = new StringBuilder();
2323
reverse.append(original);
2424
reverse = reverse.reverse();
25-
return recursiveLPS(original, reverse);
25+
return recursiveLPS(original, reverse.toString());
2626
}
2727

2828
private static String recursiveLPS(String original, String reverse) {
29-
String bestResult = ""
29+
String bestResult = "";
3030

3131
//no more chars, then return empty
3232
if(original.length() == 0 || reverse.length() == 0) {

0 commit comments

Comments
 (0)