Skip to content

Commit

Permalink
Update 0647.回文子串.md
Browse files Browse the repository at this point in the history
  • Loading branch information
QuinnDK authored May 14, 2021
1 parent cf42d80 commit a838937
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions problems/0647.回文子串.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,30 @@ Python:
Go:
```Go
func countSubstrings(s string) int {
res:=0
dp:=make([][]bool,len(s))
for i:=0;i<len(s);i++{
dp[i]=make([]bool,len(s))
}
for i:=len(s)-1;i>=0;i--{
for j:=i;j<len(s);j++{
if s[i]==s[j]{
if j-i<=1{
res++
dp[i][j]=true
}else if dp[i+1][j-1]{
res++
dp[i][j]=true
}
}
}
}
return res
}
```



Expand Down

0 comments on commit a838937

Please sign in to comment.