diff --git a/2202/220202-CN.cpp b/2202/220202-CN.cpp new file mode 100644 index 0000000..1379285 --- /dev/null +++ b/2202/220202-CN.cpp @@ -0,0 +1,15 @@ +#include +#include + +class Solution { +public: + static std::string reversePrefix(std::string word, char ch) { + std::reverse(word.begin(), std::next(word.begin(), 1 + word.find(ch))); + return word; + } +}; + +int main() { + std::cout << Solution::reversePrefix("xyxzxe", 'z'); + return 0; +} diff --git a/2202/CMakeLists.txt b/2202/CMakeLists.txt index 75b30db..cb0e1e3 100644 --- a/2202/CMakeLists.txt +++ b/2202/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2202) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2202 220201.cpp) +ADD_EXECUTABLE(2202 220202-CN.cpp)