Skip to content

Instantly share code, notes, and snippets.

@BharathKumarS
Created February 21, 2020 18:57
Show Gist options
  • Save BharathKumarS/ae01986daca6a05cf499d78223c071f8 to your computer and use it in GitHub Desktop.
Save BharathKumarS/ae01986daca6a05cf499d78223c071f8 to your computer and use it in GitHub Desktop.
Divisible sum pair - Program to check the sum pair matching the given number
# This is a test case, please check my git rrepo for the code that goes on HackerRank
def pair(a,num):
b = a
count = 0
for i in range(len(a)-1):
for j in range(i+1,len(b)):
if (a[i] + b[j]) % num == 0:
count += 1
return count
a = [1,2,3,4,5,6]
num = 5
print(pair(a,num))
@BharathKumarS
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment