Search⌘ K
AI Features

Solution: Unique Length-3 Palindromic Subsequences

Let's solve the Unique Length-3 Palindromic Subsequences problem using the Knowing What to Track pattern.

Statement

Given a string s, return the count of unique palindromic subsequences of length 33 that exist within s.

Even if a particular subsequence can be formed in multiple ways, it is counted only once.

A palindrome is a string that reads the same forwards and backwards. A subsequence is derived from the original string by deleting zero or more characters without altering the relative order of the remaining characters.

Constraints:

  • 33 \leq s.length ...