diff options
Diffstat (limited to 'progs/a546.py')
-rw-r--r-- | progs/a546.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/progs/a546.py b/progs/a546.py new file mode 100644 index 0000000..4b9bbc9 --- /dev/null +++ b/progs/a546.py @@ -0,0 +1,7 @@ +def count_pairs(arr, n, k):
+ count=0;
+ for i in range(0,n):
+ for j in range(i+1, n):
+ if arr[i] - arr[j] == k or arr[j] - arr[i] == k:
+ count += 1
+ return count
\ No newline at end of file |