[
string
palindrome
]
BinarySearch 0362 Odd Palindrome
Problem statement
https://binarysearch.com/problems/Odd-Palindrome/
Solution
If we have even palindrome, then we have even palindrome of length 2
.
Complexity
It is O(n)
for time and space.
Code
class Solution:
def solve(self, s):
return all(x != y for x, y in zip(s, s[1:]))