#3504
Longest Palindrome After Substring Concatenation II
hard · 17.7% accepted · 90 likes · top 1%
two pointers · string · dynamic programming
Description
You are given two strings, s and t.
You can create a new string by selecting a substring from s (possibly empty) and a substring from t (possibly empty), then concatenating them in order.
Return the length of the longest palindrome that can be formed this way.
Solution