Dsa
Recursion
Hard
Count Palindromic Subsequences
Write a program that counts the number of distinct palindromic subsequences in a given string using a recursive approach. The string will only contain lowercase alphabetic characters.
Input format:
- A single line containing the input string.
Output format:
- A single integer representing the count of distinct palindromic subsequences.
Example:
Input:
ababa
Output:
7
Key concepts
recursiondynamic programmingstring manipulation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now