Longest Substring Without Repeating Characters

This commit is contained in:
2022-03-20 11:37:54 +08:00
parent 7d5f585e91
commit e5239dbae7
3 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
#include "s0003_longest_substring_without_repeating_characters.hpp"
#include <gtest/gtest.h>
TEST(Problem3, Case1) {
std::string s{std::string("abcabcbb")};
Solution solution;
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 3);
}
TEST(Problem3, Case2) {
std::string s{std::string("bbbbb")};
Solution solution;
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 1);
}
TEST(Problem3, Case3) {
std::string s{std::string("pwwkew")};
Solution solution;
EXPECT_EQ(solution.lengthOfLongestSubstring(s), 3);
}