Swapping the return statements is not equivalent to swapping the "!" on and off. Think about how the for loop is going to run, keeping in mind that the code is going to end as soon it reaches any "return" statement.
Skip if the conditional is true for ANY of the looped items:
for (...) {
if (...) {
return 1;
}
}
return 0;
Skip if the conditional is false for ANY of the looped items:
for (...) {
if (!...) {
return 1;
}
}
return 0;
Do NOT skip if the conditional is true for ANY of the looped items (i.e., skip if the conditional is false for ALL of the looped items):
for (...) {
if (...) {
return 0;
}
}
return 1;
Do NOT skip if the conditional is false for ANY of the looped items (i.e., skip if the conditional is true for ALL of the looped items):
for (...) {
if (!...) {
return 0;
}
}
return 1;