Question: Task 1 : longestSeq ( ) java Write a method named longestSeq that takes as a parameter an array of integers. The method should return

Task 1: longestSeq () java
Write a method named longestSeq that takes as a parameter an array of integers. The method
should return the length of the longest consecutive sequence of integers in the array. For example,
if the array has the following values: 7,9,10,-3,-2,-1,12,20, there are two consecutive
sequences (9,10),(-3,-2,-1). The longest one is the second sequence; hence the method should
return 3. If there are no consecutive sequences in the array, the method should return 1. If the
array is empty, the return value is 0.
 Task 1: longestSeq () java Write a method named longestSeq that

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!