You could do this, which would be O(N): Run through
element in every array. For each one, you would do this:
Now, if the highest value you find isn't equal to your counter - 1 (subtract one because of the zero), you know you have a problem. And, if the total is not equal to the summation of 1 to your higest value, then you have a problem also. Otherwise, everything is correct.
In reply to Re: joining and sorting arrays
by ehdonhon
in thread joining and sorting arrays
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |