1930. Unique Length-3 Palindromic Subsequences
https://leetcode.com/problems/unique-length-3-palindromic-subsequences
Description
Given a string s
, return the number of unique palindromes of length three that are a subsequence of s
.
Note that even if there are multiple ways to obtain the same subsequence, it is still only counted once.
A palindrome is a string that reads the same forwards and backwards.
A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
For example,
"ace"
is a subsequence of"abcde"
.
Example 1:
Example 2:
Example 3:
Constraints:
3 <= s.length <= 105
s
consists of only lowercase English letters.
ac
Last updated