You are viewing a single comment's thread. Return to all comments →
public static int divisibleSumPairs(int n, int k, List<Integer> ar) { int count = 0; for(int x = 0; x < ar.size(); x++) { int i = ar.get(x); for(int y = x+1; y < ar.size(); y++) { int j = ar.get(y); if( (i+j) % k == 0) { count++; } } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →