KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 check(int array[], int n) { bool flag = 0; for(int i = 0; i < n - 1; i++) { if(array[i] != array[i + 1]) flag = 1; } return flag; }
Tags (comma-separated)
Save Edits
Cancel