Practice Longest Palindrome After Substring Concatenation II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#3504
LeetCode ProblemLongest Palindrome After Substring Concatenation II
Problem Statement
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.
Source: Longest Palindrome After Substring Concatenation II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "a", t = "a"
Output
2
# Example 2
Input
s = "abc", t = "def"
Output
1
# Example 3
Input
s = "b", t = "aaaa"
Output
4
# Example 4
Input
s = "abcde", t = "ecdba"
Output
5
Constraints
1 <= s.length, t.length <= 1000
s and t consist of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Longest Palindrome After Substring Concatenation II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.