dfs
that takes the current index i
, and two strings s1
and s2
representing the subsequences.i
is equal to the length of s
, check if s1
and s2
are palindromes. If they are, update the maximum product of their lengths.dfs
to explore adding the current character to s1
, to s2
, or to neither.isPalin
to check if a given string is a palindrome.dfs
starting with index 0 and empty strings for s1
and s2
.