#1771

Maximize Palindrome Length From Subsequences

master · 1750 · lc hard +32 · verified · 38.3% accepted · 566 likes · top 17%

Description

You are given two strings word1 and word2. Build a string by concatenating a non-empty subsequence of word1 with a non-empty subsequence of word2. Return the length of the longest palindrome constructible this way, or 0 if none can be formed.

Code

1
2
3