Palindrome · Nhóm: Chuỗi
Chuỗi đối xứng (Palindrome), nhóm Chuỗi.
def is_palindrome(s):
lo, hi = 0, len(s) - 1
while lo < hi:
if s[lo] != s[hi]:
return False
lo += 1
hi -= 1
return True
Mở trang để xem mô phỏng từng bước và xuất slide bài giảng.