Skip to content

Commit 54ca8b6

Browse files
authored
Update 0005-longest-palindromic-substring.java
1 parent 30dff1d commit 54ca8b6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

0005-longest-palindromic-substring/0005-longest-palindromic-substring.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
class Solution {
22
public String longestPalindrome(String s) {
33

4-
if(s.length() ==0 || s == null)
4+
if(s.length() ==0 )
55
{
66
return s;
77
}
8+
if(s.length() == null)
9+
{
10+
return null;
11+
}
812

913
int len = s.length();
1014
boolean[][] dp = new boolean[len][len];
@@ -41,4 +45,4 @@ else if(s.charAt(i)==s.charAt(j))
4145

4246
return s.substring(maxStart, maxEnd+1);
4347
}
44-
}
48+
}

0 commit comments

Comments
 (0)