What is the fastest method to check if all elements of an array(preferable integer array) are equal. Till now I have been using the following code:
bool chec
We'll it's basically an O(n) operation so you can't do much better than what you have, other than dispensing with the flag and just return false; on the first failure and return true; after the iteration.
return false;
return true;