111. Count palindromic substrings
Share
medium - accepted / - tried
A palindromic string reads the same backward as forward, such as 'madam'
.
Now given a string, count how many substrings it has?
Like 'madam'
, it has following palindromic strings:
'm''a''d''a''m''ada''madam'
What is the time and space cost of your solution ? Could you improve it ?
Thanks to @TechieQian for helping with the test cases.