problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::count_number_of_pairs_with_absolute_difference_k::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int countKDifference (vector< int > &nums, int k)
 

详细描述

在文件 leetcode.h1039 行定义.

成员函数说明

◆ countKDifference()

int leetcode::count_number_of_pairs_with_absolute_difference_k::Solution::countKDifference ( vector< int > &  nums,
int  k 
)
static

在文件 leetcode.cpp2632 行定义.

2632 {
2633 int ans = 0;
2634 for(int i = 0; i < nums.size(); i++) {
2635 for(int j = i + 1; j < nums.size(); j++) {
2636 if(abs(nums[i] - nums[j]) == k) {
2637 ans++;
2638 }
2639 }
2640 }
2641 return ans;
2642 }

被这些函数引用 leetcode::count_number_of_pairs_with_absolute_difference_k::TEST().


该类的文档由以下文件生成: