chore: add source

This commit is contained in:
张泊明518370910136 2024-09-11 06:07:07 -04:00
parent 2c742852fb
commit eac7a62ebe
GPG Key ID: D47306D7062CDA9D

View File

@ -104,6 +104,7 @@ func removeWhitespace(s string) string {
} }
// myersDiff computes the Myers' diff between two slices of strings. // myersDiff computes the Myers' diff between two slices of strings.
// src: https://github.com/cj1128/myers-diff/blob/master/main.go
func myersDiff(src, dst []string) []operation { func myersDiff(src, dst []string) []operation {
n := len(src) n := len(src)
m := len(dst) m := len(dst)
@ -122,7 +123,7 @@ loop:
t++ t++
} }
v[0] = t v[0] = t
if t == len(src) && t == len(dst) { if t == len(src) && len(src) == len(dst) {
break loop break loop
} }
continue continue