19 if (len_s == 0)
return len_t;
20 if (len_t == 0)
return len_s;
21 if (!strncmp(s, t, std::min(len_s, len_t)))
return 0;
24 size_t len = len_t + 1;
25 std::vector<size_t> v0(len);
26 std::vector<size_t> v1(len);
31 for (
size_t i = 0; i < len; i++)
34 for (
size_t i = 0; i < len_s; i++) {
42 for (
size_t j = 0; j < len_t; j++) {
43 size_t cost = (s[i] == t[j]) ? 0 : 1;
44 v1[j + 1] = std::min(v1[j] + 1,
45 std::min(v0[j + 1] + 1,
50 for (
size_t j = 0; j < len; j++)
size_t LevenshteinDistance(const char *s, size_t len_s, const char *t, size_t len_t)