Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Mohammed Dh Abbas
simple solution

Mohammed Dh Abbas

Oct 25, 2024

class Solution: def findCPS(self, st): def is_palindrom(s, i, j): while i <= j : if s[i] != s[j]: return False i += 1 j -= 1 return True count = 0 for i in range(0, len(st)): for j in range(i, len(st)): if is_palindrom(st, i, j): count += 1 return count

0

0

Comments
Comments
A
alik.dudin a month ago

not time efficient and also not dp

On this page