Please suggest if there is quicker way to find the negative number in a given array, provided that the array has only one negative number. I think sorting is an option, but it will be helpful if there is a quicker way.
Sorting won't be quicker than going through all the elements of the array (because to sort you also have to do that).
The fastest possible thing to do is to go through the all array and stop once you detect one negative number.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments