const std::vector more_words { "this is a sentence.", "this is also words "another line in one", "stuff words in open", "stuff words in OPEN", "whitespace\n\tagain }; ASSERT_EQ(CloseEnough(more_words, 5), 3); /* Index 3: "stuff words in open" is only distance 4 fron the next string Index 4: "stuff words in OPEN", so the function returns 3 */ ASSERT_EQ(CloseEnough(more_words, ®), -1); // No index is within e distance of the next string.
C++
I'm interested in knowing if there are two adjacent strings in a list that are very similar to each other. For instance, "Zach" and "Zack" are only one character apart.
Write a function, named "CloseEnough" that takes a const reference to a
You should be using the STL
Trending now
This is a popular solution!
Step by step
Solved in 2 steps