Question: Wave array A wave array is defined to an array which does not contain two even numbers or two odd numbers in adjacent locations. So

Wave array A wave array is defined to an array which does not contain two even numbers or two odd numbers in adjacent locations. So {7, 2, 9, 10, 5}, {4, 11, 12, 1, 6}, {1, 0, 5} and {2} are all wave arrays. But {2, 6, 3, 4} is not a wave array because the even numbers 2 and 6 are adjacent to each other. Write a javascript function named isWave that returns 1 if its array argument is a Wave array, otherwise it returns 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!