Question: Write a method that takes an integer array named array as a parameter and returns a boolean. The method should return true if there are
- Write a method that takes an integer array named array as a parameter and returns a boolean.
- The method should return true if there are three consecutive numbers that appear in the middle of the array and false otherwise. We say that something appears in the middle if there are the same number of elements to the right and to the left of the consecutive sequence.
- Sample
- int[] a = { 2, 2, 4, 6, 7, 8, 0 }; outputs true boolean b = Consecutive(a);
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
