2002. Maximum Product of the Length of Two Palindromic Subsequences
Previous2001. Number of Pairs of Interchangeable RectanglesNext2003. Smallest Missing Genetic Value in Each Subtree
Last updated
Was this helpful?
Last updated
Was this helpful?
https://leetcode.com/problems/maximum-product-of-the-length-of-two-palindromic-subsequences
Given a string s
, find two disjoint palindromic subsequences of s
such that the product of their lengths is maximized. The two subsequences are disjoint if they do not both pick a character at the same index.
Return the maximum possible product of the lengths of the two palindromic subsequences.
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. A string is palindromic if it reads the same forward and backward.
Example 1:
Example 2:
Example 3:
Constraints:
2 <= s.length <= 12
s
consists of lowercase English letters only.