Skip to content

Commit f82e16c

Browse files
committed
Add palindrome check algorithm with reference URL
1 parent 13d2cc1 commit f82e16c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

strings/is_palindrome.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
def is_palindrome(text: str) -> bool:
22
"""
33
Check if a string is a palindrome.
4+
5+
A palindrome is a word, number, phrase, or other sequence of
6+
characters which reads the same backward as forward.
7+
8+
Reference: https://en.wikipedia.org/wiki/Palindrome
9+
10+
Examples:
411
>>> is_palindrome("radar")
512
True
613
>>> is_palindrome("hello")
714
False
15+
>>> is_palindrome("level")
16+
True
817
"""
918
return text == text[::-1]
1019

0 commit comments

Comments
 (0)