Angus Ferguson wrote:I am trying to find a covering prefix...
Well, first: you need to define what a "covering prefix" is (I had to look it up); because it will be different for an
int[] than it is for a
String[] (at least the way of calculating it will be very different). Furthermore, it's quite possible that there are types for which it is simply not applicable ('can't think of one, based on what I've read; but it's worth thinking about).
However, for an
int[], it would appear to be a byproduct of the
max() function; so you might want to look at
Math.max().
Winston