add: 220209-CN
This commit is contained in:
parent
02bc4f5f62
commit
37372e4c1b
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue