ENH: single pass over array in `bincount` to determine output size

`bincount` checks its input array to make sure there are no negative entries,
and to determine the size of the output array. This is done by calling two
different functions, each having to loop over the whole array. This PR
adds a new function, `minmax`, that computes the minimum and maximum of the
array in a single pass over it. This leads to a speed up of 1.15x - 1.25x for
large arrays, and up to 2.4x for very small ones.