add: 220209-CN

This commit is contained in:
Lam Haoyin 2022-02-10 15:10:39 +08:00
parent 02bc4f5f62
commit 37372e4c1b
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
2 changed files with 18 additions and 1 deletions

17
2202/220209-CN.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <vector>
class Solution {
public:
static int countKDifference(const std::vector<int>& nums, int k) {
int ret = 0;
for (auto it = nums.begin(); it != nums.end(); ++it)
for (auto jt = std::next(it); jt != nums.end(); ++jt)
if (std::abs(*it - *jt) == k)
++ret;
return ret;
}
};
int main() {
return 0;
}

View File

@ -3,4 +3,4 @@ PROJECT(2202)
SET(CMAKE_CXX_STANDARD 23) SET(CMAKE_CXX_STANDARD 23)
ADD_EXECUTABLE(2202 220209.cpp) ADD_EXECUTABLE(2202 220209-CN.cpp)