Practice Maximum Product of the Length of Two Palindromic Subsequences
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Product of the Length of Two Palindromic Subsequences
Problem Statement
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.
Source: Maximum Product of the Length of Two Palindromic Subsequences on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "leetcodecom"
9
# Example 2
s = "bb"
1
# Example 3
s = "accbcaxxcxx"
25
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Product of the Length of Two Palindromic Subsequences.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.