Skip to content

Commit 64f8d7a

Browse files
created divisiblesumpairs.py
1 parent 99cf7d7 commit 64f8d7a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

divisiblesumpairs.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def divisibleSumPairs(n, k, ar):
2+
count = 0
3+
for i in range(0,n):
4+
5+
# (i>j)
6+
for j in range(i+1,n):
7+
if((ar[i]+ar[j])%k==0):
8+
count+=1
9+
10+
return count
11+
12+
# Complete the divisibleSumPairs function in the editor below. It should return the integer count of pairs meeting the criteria.
13+
# divisibleSumPairs has the following parameter(s):
14+
# n: the integer length of array
15+
# ar: an array of integers
16+
# k: the integer to divide the pair sum by

0 commit comments

Comments
 (0)