Array All Pairs Practice

does anyone have an idea for what we are supposed to do in this problem? Adjacent pairs would mean that there is an even number of elements. Does that mean there must be an even number of elements in the array that even number of evens elements in the array, if that makes sense?

Yup, thats exactly it, and you can check for some of the basic requirements of the array first before writing some of the other coding logic. For example, you can check that the array is not empty and, as you’ve correctly identified, does not have an odd number of elements. If the array does not satisfy those conditions, you would return false and be done. Otherwise, proceed to check that the array contains adjacent pairs.

Hope that helps.

4 Likes