Created
February 21, 2020 18:57
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
Author
BharathKumarS
commented
Feb 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment