1
# Runtime: 271 ms (Top 15.83%) | Memory: 15.4 MB (Top 41.73%)3
def checkPalindromeFormation(self, a: str, b: str) -> bool:9
# either grow from inside to outside, or vice versa15
while a[ina] == b[inb]:19
return True # short circuit found break point20
# jump into each string now!?21
# is a or b a palindrome in this portion from inb to ina22
if pal(a[inb : ina + 1]) or pal(b[inb : ina + 1]):23
return True # either one is breakpoint, so check remainder is palindrome25
while a[outa] == b[outb]:30
if pal(a[outa : outb + 1]) or pal(b[outa : outb + 1]):31
return True # either one is breakpoint, so check remainder