LeetCode 1771. Maximize Palindrome Length From Subsequences
DP
Input: word1 = "cacb", word2 = "cbba"
Output: 5
Explanation: Choose "ab" from word1 and "cba" from word2 to make "abcba", which is a palindrome.Input: word1 = "ab", word2 = "ab"
Output: 3
Explanation: Choose "ab" from word1 and "a" from word2 to make "aba", which is a palindrome.Input: word1 = "aa", word2 = "bb"
Output: 0
Explanation: You cannot construct a palindrome from the described method, so return 0.Solution:
PreviousLeetCode 1770. Maximum Score from Performing Multiplication OperationsNextLeetCode 1774. Closest Dessert Cost
Last updated