diff --git a/cpp/2206/220613-CN.cpp b/cpp/2206/220613-CN.cpp new file mode 100644 index 0000000..65125c0 --- /dev/null +++ b/cpp/2206/220613-CN.cpp @@ -0,0 +1,14 @@ +#include +#include + +class Solution { +public: + static int heightChecker(const std::vector& h) { + auto x = h; + std::stable_sort(x.begin(), x.end()); + int ret = 0; + for (int i = 0; i < x.size(); ++i) + ret += (x[i] != h[i]); + return ret; + } +}; diff --git a/cpp/2206/CMakeLists.txt b/cpp/2206/CMakeLists.txt index 9e8f7b2..09d14d6 100644 --- a/cpp/2206/CMakeLists.txt +++ b/cpp/2206/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2206) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2206 220612.cpp) +ADD_EXECUTABLE(2206 220613-CN.cpp)