Reverse Left Words

This commit is contained in:
2022-11-30 17:24:58 +08:00
parent 7b21a4bb3b
commit b13cfa00bb
5 changed files with 51 additions and 9 deletions

19
tests/offer_58.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include "offer_58.hpp"
#include <gtest/gtest.h>
TEST(Offer58, Case1) {
string s{"abcdefg"};
int k{2};
string expected{"cdefgab"};
Solution solution;
EXPECT_EQ(solution.reverseLeftWords(s, k), expected);
}
TEST(Offer58, Case2) {
string s{"lrloseumgh"};
int k{6};
string expected{"umghlrlose"};
Solution solution;
EXPECT_EQ(solution.reverseLeftWords(s, k), expected);
}