Question: Create the following method that takes an array of integers and returns true or false depending on whether the elements of the array can form
Create the following method that takes an array of integers and returns true or false depending on whether the elements of the array can form a relaxed sequence of consecutive numbers. By relaxed sequence we mean that aty two consecutive integers are allowed to have a distance larger than 1 as long as it doesn't exceed gap Duplicate numbers, though, are not forming a sequence Assume that gap-1 (no need for validation) You may not modify are and you may not create new arrays, you'll get zero points if you do ing of these public static boolean isconsecutive(int[] a, int gopo Examples isConsecutive 7. 2, 4, 6, 3. 2) is consecutive 14, 4, 2, 1, 4, 1, 1, 1) is consecutive {17, 14, 12, 10, 24, 21, 11), 3) true false Talse
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
