This is a question from Leetcode as below.

“Given an array of integers arr of even length n and an integer k. We want to divide the array into exactly n / 2 pairs such that the sum of each pair is divisible by k. Return true If you can find a way to do that or false otherwise.”

The unfinished answer is listed below,

```
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
bool main() {
int arr() = {1, 2, 3, 4, 5, 10, 6, 7, 8, 9};
int k = 5;
int arrSize = sizeof(arr)/sizeof(arr(0));
int pairs = arrSize / 2;
for (int i = 0; i < arrSize && arr(i) != INT_MIN; i++) {
for (int j = i + 1; j < arrSize && arr(j) != INT_MIN; j++) {
if ((((long)arr(i) + arr(j)) % k) == 0) {
pairs--;
if (pairs == 0)
return true;
arr(j) = INT_MIN;
break;
}
}
}
return false;
}
```

I expect the outer for loop will run till `i == arrSize - 1`

, but out of my expectation it stops at `i == 1`

and `j == 2`

. I rewrite the condition from `arr(i) != INT_MIN && i < arrSize`

to `arr(i) != INT_MIN, i < arrSize`

, then it works. I prefer to && but just can’t figure out why it doesn’t work. I have no clue why it is. Please shed light on it.