Palindromic Substrings

Deepak Belwal
Feb 3, 2024

--

Given a string s,
Return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring is a contiguous sequence of characters within the string.

Basically we have to find out the count of all the possible palindromic substrings from a string.
For this I have used two solutions, one may look easy to you and other one hard, please mention below in the comments which one you find easy or hard.

Solution 1
Solution 2

I would have provided you with the test version of the code, but i wanted you all to practise, so i did it intentionally keeping the pictures of the solution above.

This question is mostly being asked in the interviews so prepare well and keep coding…

--

--

Deepak Belwal

Army lover, Responsible_person, Influencer, Sharing Defence Knowledge, Joining the Armed Forces is my dream, Enthusiast Person, Parakarmo Vijayate, Jai Hind