Skip to content

Commit

Permalink
fix variable names in levenshtein distance python and cpp solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
prbroadfoot committed Dec 10, 2019
1 parent cc12c05 commit 57b320c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions epi_judge_cpp_solutions/levenshtein_distance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
Expand Down
4 changes: 2 additions & 2 deletions epi_judge_python_solutions/levenshtein_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 57b320c

Please sign in to comment.