Skip to content

Commit c3c8ad0

Browse files
Update palindrome.py
1 parent 33036fe commit c3c8ad0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

strings/palindrome.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"BB": True,
1212
"ABC": False,
1313
"amanaplanacanalpanama": True, # "a man a plan a canal panama"
14+
"abcdba": False,
1415
}
1516
# Ensure our test data is valid
1617
assert all((key == key[::-1]) is value for key, value in test_data.items())
@@ -61,7 +62,7 @@ def is_palindrome_recursive(s: str) -> bool:
6162
>>> all(is_palindrome_recursive(key) is value for key, value in test_data.items())
6263
True
6364
"""
64-
if len(s) <= 1:
65+
if len(s) <= 2:
6566
return True
6667
if s[0] == s[len(s) - 1]:
6768
return is_palindrome_recursive(s[1:-1])

0 commit comments

Comments
 (0)