mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-24 19:04:32 +08:00
14 lines
184 B
Go
14 lines
184 B
Go
package leetcode
|
|
|
|
func removePalindromeSub(s string) int {
|
|
if len(s) == 0 {
|
|
return 0
|
|
}
|
|
for i := 0; i < len(s)/2; i++ {
|
|
if s[i] != s[len(s)-1-i] {
|
|
return 2
|
|
}
|
|
}
|
|
return 1
|
|
}
|