for (int i = 0; i < pwlen; i++) {
if (input[i] != pw[i]) {
return FAILURE;
}
}
return SUCCESS;
that's not O(1) ... and it's bad.
difference = 0;
for (int i = 0; i < pwlen; i++) {
difference |= pw[i] ^ input[I];
}
return difference == 0;
don't worry if you don't understand this.