problemscpp
A collection of my answers to algorithm problems in c++.
| 函数
leetcode::groups_of_strings 命名空间参考

LeetCode 5995. 字符串分组 更多...

class  Solution
 

函数

 TEST (groups_of_strings, case1)
 
 TEST (groups_of_strings, case2)
 
 TEST (groups_of_strings, case3)
 
 TEST (groups_of_strings, case4)
 
 TEST (groups_of_strings, case5)
 

详细描述

LeetCode 5995. 字符串分组

函数说明

◆ TEST() [1/5]

leetcode::groups_of_strings::TEST ( groups_of_strings  ,
case1   
)

在文件 leetcode_test.cpp1146 行定义.

1146 {
1147 string input[] = {"a", "b", "ab", "cde"};
1148 auto input_vec = vector(begin(input), end(input));
1149 int output[] = {2, 3};
1150 const auto output_vec = vector(begin(output), end(output));
1151 auto sol = Solution();
1152 ASSERT_EQ(output_vec, sol.groupStrings(input_vec));
1153 }

◆ TEST() [2/5]

leetcode::groups_of_strings::TEST ( groups_of_strings  ,
case2   
)

在文件 leetcode_test.cpp1155 行定义.

1155 {
1156 string input[] = {"a", "ab", "abc"};
1157 auto input_vec = vector(begin(input), end(input));
1158 int output[] = {1, 3};
1159 const auto output_vec = vector(begin(output), end(output));
1160 auto sol = Solution();
1161 ASSERT_EQ(output_vec, sol.groupStrings(input_vec));
1162 }

◆ TEST() [3/5]

leetcode::groups_of_strings::TEST ( groups_of_strings  ,
case3   
)

在文件 leetcode_test.cpp1164 行定义.

1164 {
1165 string input[] = {"qamp", "am", "khdrn"};
1166 auto input_vec = vector(begin(input), end(input));
1167 int output[] = {3, 1};
1168 const auto output_vec = vector(begin(output), end(output));
1169 auto sol = Solution();
1170 ASSERT_EQ(output_vec, sol.groupStrings(input_vec));
1171 }

◆ TEST() [4/5]

leetcode::groups_of_strings::TEST ( groups_of_strings  ,
case4   
)

在文件 leetcode_test.cpp1173 行定义.

1173 {
1174 string input[] = {"ghnv", "uip", "tenv", "hvepx", "e", "ktc", "byjdt", "ulm", "cae", "ea"};
1175 auto input_vec = vector(begin(input), end(input));
1176 int output[] = {8, 3};
1177 const auto output_vec = vector(begin(output), end(output));
1178 auto sol = Solution();
1179 ASSERT_EQ(output_vec, sol.groupStrings(input_vec));
1180 }

◆ TEST() [5/5]

leetcode::groups_of_strings::TEST ( groups_of_strings  ,
case5   
)

在文件 leetcode_test.cpp1182 行定义.

1182 {
1183 string input[] = {"web", "a", "te", "hsx", "v", "k", "a", "roh"};
1184 auto input_vec = vector(begin(input), end(input));
1185 int output[] = {5, 4};
1186 const auto output_vec = vector(begin(output), end(output));
1187 auto sol = Solution();
1188 ASSERT_EQ(output_vec, sol.groupStrings(input_vec));
1189 }