medium - accepted / - tried
A palindromic string reads the same backward as forward, such as
Now given a string, count how many substrings it has?
'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.
Let's try to solve this problem within 10 mintues.