Search
⌘K

Leetcode 730. Count Different Palindromic Subsequences

Count the number of distinct non-empty palindromic subsequences in a string (n ≤ 1000, alphabet {a,b,c,d}), returning the result modulo 1e9+7. The core challenge is using interval dynamic programming with careful deduplication of subsequences to avoid overcounting repeated characters.

Asked at:

Salesforce


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early May, 2025

Salesforce

Senior

Write a function to count how many palindromic substrings there are in a certain string

Comments

Your account is free and you can post anonymously if you choose.