Question: 1 1 - 1 6 : Consider the following data field and method findLongest. Method findLongest is intended to find the longest consecutive block of
: Consider the following data field and method findLongest. Method findLongest is intended to find the longest consecutive block of the value target occurring in the array nums; however, findLongest does not work as intended. For example, if the array nums contains the values the call findLongest should return the length of the longest consecutive block of s Which of the following best describes the value returned by a call to findLongest?
private int nums;
public int findLongestint target
int lenCount ;
int maxLen ;
for int k ; k nums.length; k
if numsk target
lenCount;
else
if lenCount maxLen
maxLen lenCount;
if lenCount maxLen
maxLen lenCount;
return maxLen;
A It is the length of the array nums.
B It is the length of the first consecutive block of the value target in nums.
C It is the length of the shortest consecutive block of the value target in nums.
D It is the number of occurrences of the value target in nums.
E It is the length of the last consecutive block of the value target in nums.
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
