Palindromes
Coding Patterns: Palindromes (DP)
# 0(n) time | O(1) space - where n = len(string)
def isPalindrome(string):
left = 0
right = len(string) - 1
while left <= right:
if string[left] != string[right]:
return False
left += 1
right -= 1
return True
Find the original version of this page (with additional content) on Notion here.
Last update:
December 13, 2021 16:05:48
Created: December 13, 2021 16:05:48
Created: December 13, 2021 16:05:48
Authors: