From 64f8d7a7e14029caba385e7d136deddd11bac786 Mon Sep 17 00:00:00 2001 From: chanderbhanu096 Date: Sat, 17 Oct 2020 13:35:54 +0530 Subject: [PATCH] created divisiblesumpairs.py --- divisiblesumpairs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 divisiblesumpairs.py diff --git a/divisiblesumpairs.py b/divisiblesumpairs.py new file mode 100644 index 0000000..97ad5ef --- /dev/null +++ b/divisiblesumpairs.py @@ -0,0 +1,16 @@ +def divisibleSumPairs(n, k, ar): + count = 0 + for i in range(0,n): + + # (i>j) + for j in range(i+1,n): + if((ar[i]+ar[j])%k==0): + count+=1 + + return count + +# Complete the divisibleSumPairs function in the editor below. It should return the integer count of pairs meeting the criteria. +# divisibleSumPairs has the following parameter(s): +# n: the integer length of array +# ar: an array of integers +# k: the integer to divide the pair sum by