mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-30 20:58:44 +01:00
20201201: fix bug
This commit is contained in:
+7
-4
@@ -10,7 +10,7 @@ func isEcho(s string) bool {
|
||||
}
|
||||
l := 0
|
||||
r := len(s) - 1
|
||||
for r >= l {
|
||||
for r > l {
|
||||
if s[l] != s[r] {
|
||||
return false
|
||||
}
|
||||
@@ -26,9 +26,12 @@ func isAlmostEcho(s string) bool {
|
||||
}
|
||||
l := 0
|
||||
r := len(s) - 1
|
||||
for r >= l {
|
||||
if s[l] != s[r] && !isEcho(removeIndex(l, s)) && !isEcho(removeIndex(r, s)) {
|
||||
return false
|
||||
for r > l {
|
||||
if s[l] != s[r] {
|
||||
if !isEcho(removeIndex(l, s)) && !isEcho(removeIndex(r, s)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
l++
|
||||
r--
|
||||
|
||||
Reference in New Issue
Block a user