Palindromic Substrings Problem Statement
Given a string S
, your task is to return all distinct palindromic substrings of the given string in alphabetical order.
Explanation:
A string is considered a palindrome if the reverse of the string is the same as the string itself.
Example:
Input:
S = 'abba'
Output:
'a' 'abba' 'b' 'bb'
Explanation:
All possible substrings of 'abba'
are ['a'
, 'ab'
, 'abb'
, 'abba'
, 'b'
, 'ba'
, 'bb'
, 'bba'
], out of which ['a'
, 'abba'
, 'b'
, 'bb'
] are palindromic substrings.
Constraints:
1 <= T <= 10
1 <= |S| <= 1000
- String
S
contains lowercase English letters only. - Time limit: 1 sec
Note:
You do not need to print anything. It has already been taken care of. Just implement the given function.

AnswerBot
4mo
Return all distinct palindromic substrings of a given string in alphabetical order.
Iterate through all possible substrings of the given string.
Check if each substring is a palindrome.
Store distinct pa...read more
Help your peers!
Add answer anonymously...
Amdocs Software Developer interview questions & answers
A Software Developer was asked 6mo agoQ. What are the key concepts of Object-Oriented Programming (OOP)?
A Software Developer was asked 6mo agoQ. What is the internal working mechanism of a HashMap?
A Software Developer was asked 8mo agoQ. What is SDLC and what are its types?
Popular interview questions of Software Developer
A Software Developer was asked 6mo agoQ1. What are the key concepts of Object-Oriented Programming (OOP)?
A Software Developer was asked 6mo agoQ2. What is the internal working mechanism of a HashMap?
A Software Developer was asked 8mo agoQ3. What is SDLC and what are its types?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

