From 96f51b0ae3a519cd0a0255207d863948d1ba8bb1 Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Mon, 17 Feb 2025 23:05:48 +0800 Subject: [PATCH] feat: 28_find_the_index_of_the_first_occurrence_in_a_string --- .../main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 28_find_the_index_of_the_first_occurrence_in_a_string/main.cpp diff --git a/28_find_the_index_of_the_first_occurrence_in_a_string/main.cpp b/28_find_the_index_of_the_first_occurrence_in_a_string/main.cpp new file mode 100644 index 0000000..9497618 --- /dev/null +++ b/28_find_the_index_of_the_first_occurrence_in_a_string/main.cpp @@ -0,0 +1,9 @@ +#include +using namespace std; + +class Solution { + public: + int strStr(string haystack, string needle) { + return haystack.find(needle.c_str()); + } +};