Tap here to switch tabs
Problem
Submissions

Problem: Maximize Palindrome Length From Subsequences

Maximize Palindrome Length From Subsequences asks you to concatenate a nonempty subsequence from each of two strings into one string. Return its maximum palindrome length, or zero if none exists.

Statement

You are given two strings, word1 and word2.

You want to construct a string by concatenating a non empty subsequence of word1 and a non empty subsequence of word2.

Return the maximum length of a palindrome that can be constructed in this manner. If no palindrome can be formed, return 00.

Note: A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤1000\leq 1000

  • word1 and word2 consist of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximize Palindrome Length From Subsequences

Maximize Palindrome Length From Subsequences asks you to concatenate a nonempty subsequence from each of two strings into one string. Return its maximum palindrome length, or zero if none exists.

Statement

You are given two strings, word1 and word2.

You want to construct a string by concatenating a non empty subsequence of word1 and a non empty subsequence of word2.

Return the maximum length of a palindrome that can be constructed in this manner. If no palindrome can be formed, return 00.

Note: A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

Constraints:

  • 1≤1 \leq word1.length, word2.length ≤1000\leq 1000

  • word1 and word2 consist of lowercase English letters.