From 57b320c811fdbbc0ec5ec422fe1f393584d10623 Mon Sep 17 00:00:00 2001 From: Paul Broadfoot Date: Mon, 9 Dec 2019 19:37:43 -0600 Subject: [PATCH] fix variable names in levenshtein distance python and cpp solutions --- epi_judge_cpp_solutions/levenshtein_distance.cc | 4 ++-- epi_judge_python_solutions/levenshtein_distance.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epi_judge_cpp_solutions/levenshtein_distance.cc b/epi_judge_cpp_solutions/levenshtein_distance.cc index d30535c2e..09cef29db 100644 --- a/epi_judge_cpp_solutions/levenshtein_distance.cc +++ b/epi_judge_cpp_solutions/levenshtein_distance.cc @@ -42,9 +42,9 @@ int ComputeDistanceBetweenPrefixes( int substitute_last = ComputeDistanceBetweenPrefixes( A, A_idx - 1, B, B_idx - 1, distance_between_prefixes_ptr); int add_last = ComputeDistanceBetweenPrefixes( - A, A_idx - 1, B, B_idx, distance_between_prefixes_ptr); - int delete_last = ComputeDistanceBetweenPrefixes( A, A_idx, B, B_idx - 1, distance_between_prefixes_ptr); + int delete_last = ComputeDistanceBetweenPrefixes( + A, A_idx - 1, B, B_idx, distance_between_prefixes_ptr); distance_between_prefixes[A_idx][B_idx] = 1 + min({substitute_last, add_last, delete_last}); } diff --git a/epi_judge_python_solutions/levenshtein_distance.py b/epi_judge_python_solutions/levenshtein_distance.py index dbc76c1d7..16534314b 100644 --- a/epi_judge_python_solutions/levenshtein_distance.py +++ b/epi_judge_python_solutions/levenshtein_distance.py @@ -18,8 +18,8 @@ def compute_distance_between_prefixes(A_idx, B_idx): substitute_last = compute_distance_between_prefixes( A_idx - 1, B_idx - 1) - add_last = compute_distance_between_prefixes(A_idx - 1, B_idx) - delete_last = compute_distance_between_prefixes(A_idx, B_idx - 1) + add_last = compute_distance_between_prefixes(A_idx, B_idx - 1) + delete_last = compute_distance_between_prefixes(A_idx - 1, B_idx) return 1 + min(substitute_last, add_last, delete_last) return compute_distance_between_prefixes(len(A) - 1, len(B) - 1)