class Solution {
public boolean canArrange(int[] arr, int k) {
//HashMap and heap Q-3
int frequency[] = new int[k];
//find remainders
for(int val : arr){
int rem = val%k;
//if -ve add k to it
if(rem < 0) rem +=k;
frequency[rem]++;
}
//check all rem and [k-rem]
if(frequency[0] %2 != 0) return false;
for(int i = 1 ; i <= k/2 ; i++){
if(frequency[i] != frequency[k-i])
return false;
}
return true;
}
}