Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started