Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Definitely agree. Can terminate after 5 matches.
You don't actually need to even traverse the entire list in most scenarios.
In a best case scenario you can return after just 3 iterations, for example, let's assume the target value (in this case odd) is at index 0 in the array. You record the index of the odd value within an oddIndexes list. You then make a further iteration and find an even value which, the index of which you store in an evenIndex list. You then make one more iteration and find another even value, at this point you now know the target value has to be odd of which you already have the index stored.
Worst case scenario is that the odd value is at the end of the array and you have to iterate the whole way through.