Tap here to switch tabs
Problem
Submissions

Problem: Maximize Palindrome Length From Subsequences

Try to solve the Maximize Palindrome Length From Subsequences problem.

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

Try to solve the Maximize Palindrome Length From Subsequences problem.

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.