From 4373489273a16df6205a6c0fc61827b543bba460 Mon Sep 17 00:00:00 2001 From: Philip Top Date: Mon, 21 Apr 2025 09:27:50 -0700 Subject: [PATCH] fix pre-commit items --- examples/close_match.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/close_match.cpp b/examples/close_match.cpp index 403f808a..c3952271 100644 --- a/examples/close_match.cpp +++ b/examples/close_match.cpp @@ -25,21 +25,21 @@ int levenshteinDistance(const std::string &s1, const std::string &s2) { for(size_t i = 1; i <= len1; ++i) { for(size_t j = 1; j <= len2; ++j) { int cost = (s1[i - 1] == s2[j - 1]) ? 0 : 1; - dp[i][j] = std::min({ - dp[i - 1][j] + 1, // deletion - dp[i][j - 1] + 1, // insertion - dp[i - 1][j - 1] + cost // substitution - }); + dp[i][j] = (std::min)({ + dp[i - 1][j] + 1, // deletion + dp[i][j - 1] + 1, // insertion + dp[i - 1][j - 1] + cost // substitution + }); } } return dp[len1][len2]; } -// Finds the closest string from a list +// Finds the closest string from a list (modified from chat gpt code) std::pair findClosestMatch(const std::string &input, const std::vector &candidates) { std::string closest; - int minDistance = std::numeric_limits::max(); + int minDistance = (std::numeric_limits::max)(); for(const auto &candidate : candidates) { int distance = levenshteinDistance(input, candidate);