From 8262cb8e452e8d1f489cabfe6109667699eccdc2 Mon Sep 17 00:00:00 2001 From: VildanWW Date: Fri, 27 Nov 2026 17:01:19 +0500 Subject: [PATCH] Update brute_force_string_searching.cpp Swap int on int64_t --- strings/brute_force_string_searching.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/strings/brute_force_string_searching.cpp b/strings/brute_force_string_searching.cpp index e608a07e4..4763a7984 100644 --- a/strings/brute_force_string_searching.cpp +++ b/strings/brute_force_string_searching.cpp @@ -10,6 +10,7 @@ #include /// For assert #include /// For IO operations #include /// For std::string +#include /// For uint64_t /** * @namespace string_search @@ -24,15 +25,15 @@ namespace string_search { * @returns Index where the pattern starts in the text * @returns -1 if the pattern was not found. */ - int brute_force(const std::string& text, const std::string& pattern) { + int64_t brute_force(const std::string& text, const std::string& pattern) { size_t pattern_length = pattern.length(); size_t text_length = text.length(); - int index = -1; + int64_t index = -1; if (pattern_length <= text_length) { for (size_t i = 0; i < text_length - pattern_length + 1; i++) { std::string current_substring = text.substr(i, pattern_length); if (current_substring == pattern) { - index = i; + index = static_cast(i); break; } }